Skip to content

Commit

Permalink
Remove redundant exception traceback (#102)
Browse files Browse the repository at this point in the history
`log.exception` already includes a traceback, so don't add another.
  • Loading branch information
rgov committed Jul 27, 2020
1 parent f125365 commit 82f0872
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions umodbus/server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ def handle(self):
response_adu = self.process(mbap_header + request_pdu)
self.respond(response_adu)
except:
import traceback
log.exception('Error while handling request: {0}.'
.format(traceback.print_exc()))
log.exception('Error while handling request')
raise

def process(self, request_adu):
Expand Down Expand Up @@ -91,8 +89,8 @@ def execute_route(self, meta_data, request_pdu):
except ModbusError as e:
function_code = get_function_code_from_request_pdu(request_pdu)
return pack_exception_pdu(function_code, e.error_code)
except Exception as e:
log.exception('Could not handle request: {0}.'.format(e))
except Exception:
log.exception('Could not handle request')
function_code = get_function_code_from_request_pdu(request_pdu)

return pack_exception_pdu(function_code,
Expand Down

0 comments on commit 82f0872

Please sign in to comment.