Skip to content

Commit

Permalink
Return 429 Too Many Requests for gRPC error code ResourceExhausted
Browse files Browse the repository at this point in the history
…from Trillian (#1401)

* Return 429 Too Many Requests for gRPC error code `ResourceExhausted`

* Update CHANGELOG.md
  • Loading branch information
roger2hk authored Apr 15, 2024
1 parent 1ce7287 commit 2aea376
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

* Adds the ability for a CT client to disable root compatibile checking: https://github.com/google/certificate-transparency-go/pull/1258

### Fixes

* Return 429 Too Many Requests for gRPC error code `ResourceExhausted` from Trillian.

## v1.1.8

* Recommended Go version for development: 1.21
Expand Down
4 changes: 3 additions & 1 deletion trillian/ctfe/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1118,8 +1118,10 @@ func (li *logInfo) toHTTPStatus(err error) int {
return http.StatusBadRequest
case codes.NotFound:
return http.StatusNotFound
case codes.PermissionDenied, codes.ResourceExhausted:
case codes.PermissionDenied:
return http.StatusForbidden
case codes.ResourceExhausted:
return http.StatusTooManyRequests
case codes.Unauthenticated:
return http.StatusUnauthorized
case codes.FailedPrecondition:
Expand Down

0 comments on commit 2aea376

Please sign in to comment.