sdk-python
sdk-python copied to clipboard
Preserve Raw Error Type in Nexus Handler Errors
Update to nexus-rpc that allows creating nexusrpc.HandlerError from an error type string. Refactor converter to use the string constructor rather than determining the nexusrpc.HandlerErrorType. Update references to nexusrpc.HandlerError to use the renamed error_type field.
What was changed
- Renamed all references from HandlerError.type to HandlerError.error_type throughout
- Refactored DefaultFailureConverter.from_failure() in temporalio/converter.py:1186-1199 to construct nexusrpc.HandlerError directly from error type strings instead of converting to HandlerErrorType enum
- Removed the try/except logic that handled unknown HandlerErrorType values with fallback to INTERNAL
Why?
The nexus-rpc library now supports creating HandlerError instances directly from error type strings rather than requiring enum values. This change:
- Simplifies error handling by eliminating the need for string-to-enum conversion
- Removes special handling for unknown error types (no more KeyError catching and logging)
- Provides better forward compatibility - new error types added by the server won't cause issues in the client
- Aligns with upstream nexus-rpc API changes where the field was renamed from type to error_type
Checklist
How was this tested
- Used existing tests to confirm no behavioral changes