Skip to content

Commit

Permalink
Allow translator based header fix up to go wrong
Browse files Browse the repository at this point in the history
It's possible that some headers are so broken that the
code trying to fix them up can't work out something.
A date is a good example since an error parsing a date
in a header will cause many date-based corrections to
fail.

Log the problem and hope that a file-based correction
is put in place that allows the translator code to
function properly.
  • Loading branch information
timj committed Dec 12, 2019
1 parent 2264edb commit 7e697d2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion python/astro_metadata_translator/headers.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,12 @@ class or else support automatic translation class determination.
modified = _find_from_resource(header, *translator.resource_root(), target_file)

# Allow a translation class to do local fixups
translator_modified = translator_class.fix_header(header)
# Allow it to fail but log the failure
try:
translator_modified = translator_class.fix_header(header)
except Exception as e:
log.fatal("Ignoring translator header fixup of %s %s: %s",
instrument, obsid, str(e))
translator_modified = False

return modified | translator_modified

0 comments on commit 7e697d2

Please sign in to comment.