Skip to content

Commit

Permalink
Update the message for unhandled errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcel Stimberg committed Oct 11, 2013
1 parent 5b9e33e commit e56108a
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions brian2/utils/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,10 @@ def _encode(text):
version=str(_version)))


UNHANDLED_ERROR_MESSAGE = ('Brian encountered an unexpected error. '
'If you think this is bug in Brian, please report this issue either to the '
'mailing list at <http://groups.google.com/group/brian-support/>, '
'or to the issue tracker at <http://neuralensemble.org/trac/brian/report>. '
'Please include this file with debug information in your report: {logfile} '
' Additionally, you can also include a copy of the script that was run, '
'available at: {filename} Thanks!').format(logfile=TMP_LOG, filename=TMP_SCRIPT)
UNHANDLED_ERROR_MESSAGE = ('Brian 2 encountered an unexpected error. '
'If you think this is bug in Brian 2, please report this issue either to the '
'mailing list at <http://groups.google.com/group/brian-development/>, '
'or to the issue tracker at <https://github.com/brian-team/brian2/issues>.')


def brian_excepthook(exc_type, exc_obj, exc_tb):
Expand All @@ -185,9 +182,20 @@ def brian_excepthook(exc_type, exc_obj, exc_tb):
exception.
'''
BrianLogger.exception_occured = True

logger.error(UNHANDLED_ERROR_MESSAGE,
exc_info=(exc_type, exc_obj, exc_tb))

message = UNHANDLED_ERROR_MESSAGE
if TMP_LOG is not None:
message += (' Please include this file with debug information in your '
'report: {} ').format(TMP_LOG)
if TMP_SCRIPT is not None:
message += (' Additionally, you can also include a copy '
'of the script that was run, available '
'at: {}').format(TMP_SCRIPT)

message += ' Thanks!' # very important :)

logger.error(message, exc_info=(exc_type, exc_obj, exc_tb))


def clean_up_logging():
'''
Expand Down

0 comments on commit e56108a

Please sign in to comment.