##// END OF EJS Templates
add InteractiveShell.show_usage_error...
MinRK -
Show More
@@ -1672,7 +1672,13 b' class InteractiveShell(SingletonConfigurable):'
1672
1672
1673 return etype, value, tb
1673 return etype, value, tb
1674
1674
1675
1675 def show_usage_error(self, exc):
1676 """Show a short message for UsageErrors
1677
1678 These are special exceptions that shouldn't show a traceback.
1679 """
1680 self.write_err("UsageError: %s" % exc)
1681
1676 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None,
1682 def showtraceback(self,exc_tuple = None,filename=None,tb_offset=None,
1677 exception_only=False):
1683 exception_only=False):
1678 """Display the exception that just occurred.
1684 """Display the exception that just occurred.
@@ -1698,7 +1704,7 b' class InteractiveShell(SingletonConfigurable):'
1698 # line, there may be SyntaxError cases with imported code.
1704 # line, there may be SyntaxError cases with imported code.
1699 self.showsyntaxerror(filename)
1705 self.showsyntaxerror(filename)
1700 elif etype is UsageError:
1706 elif etype is UsageError:
1701 self.write_err("UsageError: %s" % value)
1707 self.show_usage_error(value)
1702 else:
1708 else:
1703 if exception_only:
1709 if exception_only:
1704 stb = ['An exception has occurred, use %tb to see '
1710 stb = ['An exception has occurred, use %tb to see '
@@ -2597,8 +2603,8 b' class InteractiveShell(SingletonConfigurable):'
2597 try:
2603 try:
2598 self.input_transformer_manager.push(raw_cell)
2604 self.input_transformer_manager.push(raw_cell)
2599 cell = self.input_transformer_manager.source_reset()
2605 cell = self.input_transformer_manager.source_reset()
2600 except UsageError:
2606 except UsageError as e:
2601 self.showtraceback()
2607 self.show_usage_error(e)
2602 return
2608 return
2603
2609
2604 # Our own compiler remembers the __future__ environment. If we want to
2610 # Our own compiler remembers the __future__ environment. If we want to
General Comments 0
You need to be logged in to leave comments. Login now