Skip to content

Commit

Permalink
Merge pull request #31 from ybrustin/master
Browse files Browse the repository at this point in the history
fix returned exception in case of several lines in error
  • Loading branch information
tcalmant committed May 5, 2017
2 parents f65afc1 + 30dc954 commit 5f53fcd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions jsonrpclib/SimpleJSONRPCServer.py
Expand Up @@ -384,8 +384,8 @@ def _dispatch(self, method, params, config=None):
return fault
except:
# Method exception
err_lines = traceback.format_exc().splitlines()
trace_string = '{0} | {1}'.format(err_lines[-3], err_lines[-1])
err_lines = traceback.format_exception(*sys.exc_info())
trace_string = '{0} | {1}'.format(err_lines[-2].splitlines()[0].strip(), err_lines[-1])
fault = Fault(-32603, 'Server error: {0}'.format(trace_string),
config=config)
_logger.exception("Server-side exception: %s", fault)
Expand Down Expand Up @@ -451,8 +451,8 @@ def do_POST(self):
except:
# Exception: send 500 Server Error
self.send_response(500)
err_lines = traceback.format_exc().splitlines()
trace_string = '{0} | {1}'.format(err_lines[-3], err_lines[-1])
err_lines = traceback.format_exception(*sys.exc_info())
trace_string = '{0} | {1}'.format(err_lines[-2].splitlines()[0].strip(), err_lines[-1])
fault = jsonrpclib.Fault(-32603, 'Server error: {0}'
.format(trace_string), config=config)
_logger.exception("Server-side error: %s", fault)
Expand Down

0 comments on commit 5f53fcd

Please sign in to comment.