Skip to content

Commit

Permalink
Record now auto adds errno if it's missing from the exception repr
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmoud committed Jul 2, 2016
1 parent 55af366 commit 9553fdd
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lithoxyl/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,14 @@ def _exception(self, exc_type, exc_val, exc_tb, message, fargs, data):
exc_info = ExceptionInfo.from_exc_info(exc_type, exc_val, exc_tb)
if not message:
cp = exc_info.tb_info.frames[-1]
t = "%s raised exception: %s(%r) from %s on line %s of file '%s'"
t = "%s raised exception: "
exc_repr = "%s(%r)"
errno = getattr(exc_val, 'errno', None)
if errno and str(errno) not in exc_repr:
t += exc_repr + ' (errno %s)' % exc_val.errno
else:
t += exc_repr
t += "from %s on line %s of file '%s'"
if self.data_map:
t += ' - ({data_map_repr})'
message = t % (self.name, exc_info.exc_type, exc_info.exc_msg,
Expand Down

0 comments on commit 9553fdd

Please sign in to comment.