##// END OF EJS Templates
don't crash apps on TraitErrors when parsing command-line
MinRK -
Show More
@@ -31,7 +31,7 b' from IPython.config.loader import ('
31 )
31 )
32
32
33 from IPython.utils.traitlets import (
33 from IPython.utils.traitlets import (
34 Unicode, List, Int, Enum, Dict, Instance
34 Unicode, List, Int, Enum, Dict, Instance, TraitError
35 )
35 )
36 from IPython.utils.importstring import import_item
36 from IPython.utils.importstring import import_item
37 from IPython.utils.text import indent, wrap_paragraphs, dedent
37 from IPython.utils.text import indent, wrap_paragraphs, dedent
@@ -326,12 +326,12 b' class Application(SingletonConfigurable):'
326 flags=self.flags)
326 flags=self.flags)
327 try:
327 try:
328 config = loader.load_config()
328 config = loader.load_config()
329 except ArgumentError as e:
329 self.update_config(config)
330 self.log.fatal(str(e))
330 except (TraitError, ArgumentError) as e:
331 self.print_description()
331 self.print_description()
332 self.print_help()
332 self.print_help()
333 self.log.fatal(str(e))
333 self.exit(1)
334 self.exit(1)
334 self.update_config(config)
335 # store unparsed args in extra_args
335 # store unparsed args in extra_args
336 self.extra_args = loader.extra_args
336 self.extra_args = loader.extra_args
337
337
@@ -277,8 +277,9 b' class BaseIPythonApplication(Application):'
277
277
278
278
279 def initialize(self, argv=None):
279 def initialize(self, argv=None):
280 self.init_crash_handler()
280 # don't hook up crash handler before parsing command-line
281 self.parse_command_line(argv)
281 self.parse_command_line(argv)
282 self.init_crash_handler()
282 if self.subapp is not None:
283 if self.subapp is not None:
283 # stop here if subapp is taking over
284 # stop here if subapp is taking over
284 return
285 return
General Comments 0
You need to be logged in to leave comments. Login now