Bliss shell: better error management
Errors in the bliss shell could be shown in a more human readable way (less scary for non python users).
Proposal
Error report mode
- by default its value is
simple
- it can take two values
simple
|expert
- it can be set as a command line flag (ex:
--error-report=simple
) - it can be modified at any time on the bliss shell with:
REPL.error_report = 'expert'
(or/and a helper function)
Ability to recover last error info
REPL.last_error
(or/and a helper function to retrieve the last error (full sys.exc_info).
Hint the traceback should be a string representation to avoid a memory leak
User interface
BLISS [1]: # In basic mode:
BLISS [2]: 1 / 0
ZeroDivisionError: integer division or modulo by zero
BLISS [3]: # In expert mode:
BLISS [4]: 1 / 0
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero
integer division or modulo by zero
BLISS [5]: last_error()
Command: '1 / 0'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ZeroDivisionError: integer division or modulo by zero
integer division or modulo by zero