Skip to content

Comments

Improve HTTP error handling for 401/403 and replace KeyError for 404#1410

Open
harshitnagar22 wants to merge 2 commits intoDiamondLightSource:mainfrom
harshitnagar22:fix-http-error-handling
Open

Improve HTTP error handling for 401/403 and replace KeyError for 404#1410
harshitnagar22 wants to merge 2 commits intoDiamondLightSource:mainfrom
harshitnagar22:fix-http-error-handling

Conversation

@harshitnagar22
Copy link

This PR improves HTTP error handling in the client.

Changes:

  • Added explicit handling for 401 (Unauthorized) and 403 (Forbidden) status codes.
  • Replaced the use of KeyError for 404 responses with a more appropriate API error.
  • Improved error messages for better clarity and debugging.

This aligns error handling more closely with standard HTTP semantics and avoids using KeyError for non-dictionary-related issues.

Fixes #1409

This PR improves HTTP error handling in the client.

Changes:
- Added explicit handling for 401 (Unauthorized) and 403 (Forbidden) status codes.
- Replaced the use of KeyError for 404 responses with a more appropriate API error.
- Improved error messages for better clarity and debugging.

This aligns error handling more closely with standard HTTP semantics and avoids using KeyError for non-dictionary-related issues.

Fixes DiamondLightSource#1409
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve default error handling

1 participant