Always log exception using logging.exception

This commit is contained in:
Josh Wu
2025-08-18 15:38:43 +08:00
parent 3b8dd6f3cf
commit 4a88e9a0cf
16 changed files with 65 additions and 74 deletions

View File

@@ -1084,8 +1084,8 @@ class Server:
def on_pdu(self, pdu):
try:
sdp_pdu = SDP_PDU.from_bytes(pdu)
except Exception as error:
logger.warning(color(f'failed to parse SDP Request PDU: {error}', 'red'))
except Exception:
logger.exception(color('failed to parse SDP Request PDU', 'red'))
self.send_response(
SDP_ErrorResponse(
transaction_id=0, error_code=SDP_INVALID_REQUEST_SYNTAX_ERROR
@@ -1100,8 +1100,8 @@ class Server:
if handler:
try:
handler(sdp_pdu)
except Exception as error:
logger.exception(f'{color("!!! Exception in handler:", "red")} {error}')
except Exception:
logger.exception(color("!!! Exception in handler:", "red"))
self.send_response(
SDP_ErrorResponse(
transaction_id=sdp_pdu.transaction_id,