tensorzero
tensorzero copied to clipboard
Expose gateway errors in TS client
This PR refactors error handling in the TS client so that response errors more closely mirror those returned from the gateway. Errors that are properly handled can then be exposed directly to users with less obfuscation.
Closes https://github.com/tensorzero/tensorzero/issues/2168 and https://github.com/tensorzero/tensorzero/issues/1763
[!IMPORTANT] Refactor TS client error handling to use
TensorZeroServerErrorfor clearer gateway error messages.
- Error Handling:
- Introduces
TensorZeroServerErrorinerrors.tsto handle server errors with specific status codes and messages.- Replaces
HttpErrorwithTensorZeroServerErrorintensorzero.tsfor more detailed error handling.- Updates error handling in
inference.ts,route.tsx, andtensorzero.server.tsto useisTensorZeroServerError()for checking server errors.- Code Refactoring:
- Moves
tensorzero.tstotensorzero/tensorzero.tsand updates imports accordingly.- Removes
ServerRequestErrorandisServerRequestError()fromcommon.ts.- Dependencies:
- Adds
http-status-codestopackage.jsonfor standardized HTTP status codes.This description was created by
for 735445589c7a9fae54d4bf9ffddffb0bf23d92f8. You can customize this summary. It will automatically update as commits are pushed.