Skip to content

Cleanup exception and error handling#103

Merged
happymancoder merged 3 commits intomasterfrom
client-updates
Mar 2, 2025
Merged

Cleanup exception and error handling#103
happymancoder merged 3 commits intomasterfrom
client-updates

Conversation

@MrSmoke
Copy link
Member

@MrSmoke MrSmoke commented Feb 28, 2025

Breaking changes

Major

  • 403 now throws a ForbiddenException instead of a UnauthorizedException
  • Error.Body is now nullable

Minor

  • Renamed TooManyRequestException to TooManyRequestsException
  • Specific http client exceptions (such as BadRequestException) no longer accept a HttpStatusCode in the constructor

Changes

  • Cleanup ErrorHelper.GetErrorException to simplify exception generation. All 1xx/2xx/3xx no longer throw any exceptions
  • Updated ClickViewClientHttpException to have a nullable message
  • Added new ForbiddenException which is now thrown on 403 responses
  • Fix nullable warnings in QueryHelpers
  • Removed GetDefaultErrorBody from BaseRestClientRequest
  • Updated GetErrorAsync to set Error.Body to null if TryParseErrorBody did not parse an error body
  • Added a default implementation of TryParseErrorBody which uses ReasonPhrase as the message (if set)
  • Shim 429 status code and remove custom int cast in error handling logic

@happymancoder happymancoder merged commit 6497d72 into master Mar 2, 2025
4 checks passed
@happymancoder happymancoder deleted the client-updates branch March 2, 2025 23:55
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.

2 participants