Skip to content

Commit 7fd070c

Browse files
lobocvCalvin Lobo
andauthored
Bug fix: HTTP Default mapping does not include mapping for 503 (#16)
Co-authored-by: Calvin Lobo <[email protected]>
1 parent 810e050 commit 7fd070c

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

ecosystem/http/translate_error_code.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ func DefaultMapping() map[simplerr.Code]HTTPStatus {
3232
simplerr.CodeNotImplemented: http.StatusNotImplemented,
3333
simplerr.CodeMalformedRequest: http.StatusBadRequest,
3434
simplerr.CodeInvalidArgument: http.StatusUnprocessableEntity,
35+
simplerr.CodeUnavailable: http.StatusServiceUnavailable,
3536
simplerr.CodeMissingParameter: http.StatusUnprocessableEntity,
3637
simplerr.CodeResourceExhausted: http.StatusTooManyRequests,
3738
}

ecosystem/http/translate_error_code_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func (s *TestSuite) TestTranslateErrorCode() {
3939
{fmt.Errorf("something"), http.StatusInternalServerError, false},
4040
{simplerr.New("something").Code(simplerr.CodeUnknown), http.StatusInternalServerError, false},
4141
{simplerr.New("something").Code(simplerr.CodePermissionDenied), http.StatusForbidden, true},
42+
{simplerr.New("something").Code(simplerr.CodeUnavailable), http.StatusServiceUnavailable, true},
4243
{simplerr.New("something").Code(simplerr.CodeCanceled), http.StatusRequestTimeout, true},
4344
{simplerr.New("something").Code(simplerr.CodeConstraintViolated), http.StatusInternalServerError, false},
4445
{simplerr.New("something").Code(simplerr.CodeMalformedRequest), http.StatusBadRequest, true},

0 commit comments

Comments
 (0)