-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: raise errors for non-2xx status codes (#352)
- 3xx status code is considered an error - All known 3xx status codes will throw a RedirectError exception - Unknown 3xx status codes will throw a UnexpectedHttpError exception (same as 5xx) - 1xx status codes also count as errors - Allow CI to be run manually (ironically, this will trigger an automatic CI run)
- Loading branch information
Showing
8 changed files
with
188 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ on: | |
push: | ||
branches: [ master ] | ||
pull_request: ~ | ||
workflow_dispatch: ~ | ||
|
||
jobs: | ||
lint: | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
using System.Collections.Generic; | ||
using EasyPost.Models.API; | ||
|
||
namespace EasyPost.Exceptions.API | ||
{ | ||
public class RedirectError : ApiError | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="RedirectError" /> class. | ||
/// </summary> | ||
/// <param name="errorMessage">Error message string to print to console.</param> | ||
/// <param name="statusCode">Optional HTTP status code to store as a property.</param> | ||
/// <param name="errorType">Optional error type string to store as a property.</param> | ||
/// <param name="errors">Optional list of Error objects to store as a property.</param> | ||
internal RedirectError(string errorMessage, int statusCode, string? errorType = null, List<Error>? errors = null) : base(errorMessage, statusCode, errorType, errors) | ||
{ | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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