Skip to content

Commit

Permalink
Merge pull request #2171 from cta-observatory/tool_trait_error_message
Browse files Browse the repository at this point in the history
Improve output of Tool in case of TraitError
  • Loading branch information
maxnoe authored Dec 16, 2022
2 parents 94649e5 + e6835ad commit a633e0f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ctapipe/core/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import yaml
from docutils.core import publish_parts
from traitlets import TraitError

try:
import tomli as toml
Expand Down Expand Up @@ -359,8 +360,9 @@ def run(self, argv=None, raises=False):
self.finish()
self.log.info(f"Finished: {self.name}")
Provenance().finish_activity(activity_name=self.name)
except ToolConfigurationError as err:
self.log.error(f"{err}. Use --help for more info")
except (ToolConfigurationError, TraitError) as err:
self.log.error("%s", err)
self.log.error("Use --help for more info")
exit_status = 2 # wrong cmd line parameter
except KeyboardInterrupt:
self.log.warning("WAS INTERRUPTED BY CTRL-C")
Expand Down

0 comments on commit a633e0f

Please sign in to comment.