Repository navigation
Conversation
…uthorized/Forbidden
Every AdminApi method turned HttpClientError into a defect, so failures its
type declares (connection errors, undeclared statuses) killed the fiber and
catchTag("HttpClientError") never ran. 401 and 403 responses now become
Unauthorized and Forbidden on every method whatever their body, as HttpError
promises. Schema errors stay defects.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Admin API methods turned every
HttpClientErrorinto a defect, so failures their own error type declares killed the fiber andcatchTagnever ran. They now stay typed failures, and 401 and 403 becomeUnauthorizedandForbiddenon every method, whatever the body.HttpClientErrorinstead of a defect.UnauthorizedorForbiddenon every method, asHttpErroralready promised, including with Amp's{"error_code": …}body or an empty one.You might prefer:
api.ts, with schemas that accept Amp's error bodies, instead of mapping them by status in the service.SchemaErrortoo. It's still a defect, but it isn't in any method's error type, so I left it.error_message.UnauthorizedandForbiddenhave no fields, so it's dropped.Checks:
pnpm lint,pnpm check:tsgo,pnpm test(237 passed, 4 new) andpnpm circularpass.FetchHttpClient, a closed port and a local server answering 401, 403, 404 and 502 all fail with the expected typed error instead of dying.getDatasets,getProviders,getWorkersandgetJobsstill decode, andgetJobByIdandstopJobstill fail withJobNotFoundError.Fixes #29
🤖 Generated with Claude Code