diff options
author | Miklos Vajna <vmiklos@frugalware.org> | 2011-10-06 16:31:41 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@frugalware.org> | 2011-10-06 16:36:04 +0200 |
commit | 551a13f54e3e0f69d243b50db4f1b442ecce059a (patch) | |
tree | 7a9a47872caf419cbb368f321103a986ad44d4a3 /l10ntools | |
parent | update unused list, note AtomPubSession dtor unused, i.e. probable leak (diff) | |
download | core-551a13f54e3e0f69d243b50db4f1b442ecce059a.tar.gz core-551a13f54e3e0f69d243b50db4f1b442ecce059a.zip |
Give better error message on invalid sdf input
Diffstat (limited to 'l10ntools')
-rwxr-xr-x | l10ntools/scripts/po2lo | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/l10ntools/scripts/po2lo b/l10ntools/scripts/po2lo index 969f3eae0e95..a815739fb893 100755 --- a/l10ntools/scripts/po2lo +++ b/l10ntools/scripts/po2lo @@ -52,9 +52,14 @@ class Entry: self.keys = [] # 10..13 are translation types for idx in range(10, 14): - if len(self.items[idx]): - t = {10:'text', 12:'quickhelptext', 13:'title'}[idx] - self.keys.append((idx, self.sdf2po("%s#%s.%s%s" % (path[-1], self.items[4], prefix, t)))) + try: + if len(self.items[idx]): + t = {10:'text', 12:'quickhelptext', 13:'title'}[idx] + self.keys.append((idx, self.sdf2po("%s#%s.%s%s" % (path[-1], self.items[4], prefix, t)))) + except IndexError: + print("Tried to access field #%d in sdf file, but no such column! Broken sdf file?" % idx) + print("Fields: %s" % self.items) + sys.exit(1) def translate(self, translations): """Translates text in the entry based on translations.""" |