Skip to content

Commit

Permalink
Make brian_object_exception more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
mstimberg committed Apr 11, 2019
1 parent 8b6bcb1 commit f130943
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion brian2/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,5 +347,8 @@ def brian_object_exception(message, brianobj, original_exception):
for attribute in dir(original_exception):
if attribute.startswith('_'):
continue
setattr(new_exception, attribute, getattr(original_exception, attribute))
try:
setattr(new_exception, attribute, getattr(original_exception, attribute))
except AttributeError: # some attributes cannot be set
pass
return new_exception

0 comments on commit f130943

Please sign in to comment.