Initial Checks
Description
Follow-up to #2541 (fixed in #2542). The same pattern exists in 12 additional sites across 7 files. Each catches an exception and re-raises a new one without from, discarding the original traceback and __cause__.
Sites:
| File |
Line |
Caught |
Raised |
client/session.py |
346 |
ValidationError |
RuntimeError |
client/session.py |
348 |
SchemaError |
RuntimeError |
client/auth/utils.py |
246 |
ValidationError |
OAuthRegistrationError |
client/auth/utils.py |
339 |
ValidationError |
OAuthTokenError |
server/auth/middleware/client_auth.py |
83 |
ValueError/UnicodeDecodeError/binascii.Error |
AuthenticationError |
server/mcpserver/resources/types.py |
75 |
Exception |
ValueError |
server/mcpserver/resources/types.py |
151 |
Exception |
ValueError |
server/mcpserver/resources/types.py |
196 |
Exception |
ValueError |
server/mcpserver/resources/types.py |
205 |
Exception |
ValueError |
server/mcpserver/resources/resource_manager.py |
96 |
Exception |
ValueError |
server/mcpserver/resources/templates.py |
133 |
Exception |
ValueError |
server/mcpserver/prompts/base.py |
185, 189 |
Exception |
ValueError |
Impact
Same as #2541: without from, Python shows "During handling of the above exception, another exception occurred" instead of "The above exception was the direct cause of the following exception." Callers cannot inspect __cause__ to determine the root cause programmatically.
The codebase already uses from correctly in server.py:451, server.py:459, server.py:1112, func_metadata.py:216,265, and tools/base.py:119. These 12 sites are the remaining inconsistencies.
Initial Checks
Description
Follow-up to #2541 (fixed in #2542). The same pattern exists in 12 additional sites across 7 files. Each catches an exception and re-raises a new one without
from, discarding the original traceback and__cause__.Sites:
client/session.pyValidationErrorRuntimeErrorclient/session.pySchemaErrorRuntimeErrorclient/auth/utils.pyValidationErrorOAuthRegistrationErrorclient/auth/utils.pyValidationErrorOAuthTokenErrorserver/auth/middleware/client_auth.pyValueError/UnicodeDecodeError/binascii.ErrorAuthenticationErrorserver/mcpserver/resources/types.pyExceptionValueErrorserver/mcpserver/resources/types.pyExceptionValueErrorserver/mcpserver/resources/types.pyExceptionValueErrorserver/mcpserver/resources/types.pyExceptionValueErrorserver/mcpserver/resources/resource_manager.pyExceptionValueErrorserver/mcpserver/resources/templates.pyExceptionValueErrorserver/mcpserver/prompts/base.pyExceptionValueErrorImpact
Same as #2541: without
from, Python shows "During handling of the above exception, another exception occurred" instead of "The above exception was the direct cause of the following exception." Callers cannot inspect__cause__to determine the root cause programmatically.The codebase already uses
fromcorrectly inserver.py:451,server.py:459,server.py:1112,func_metadata.py:216,265, andtools/base.py:119. These 12 sites are the remaining inconsistencies.