Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit dd7239f

Browse files
committed
errdefs: remove unneeded recursive calls
The `statusCodeFromGRPCError` and `statusCodeFromDistributionError` helpers are used by `GetHTTPErrorStatusCode`, which already recurses if the error implements the `Causer` interface. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit 32f4fdfb5c8846922302c20fdcab973227eb9bd6) Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: b2694b459fc9653420c2a62d7301fbb61f47727c Component: engine
1 parent a62d4a6 commit dd7239f

1 file changed

Lines changed: 0 additions & 7 deletions

File tree

components/engine/errdefs/http_helpers.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,6 @@ func statusCodeFromGRPCError(err error) int {
141141
case codes.Unavailable: // code 14
142142
return http.StatusServiceUnavailable
143143
default:
144-
if e, ok := err.(causer); ok {
145-
return statusCodeFromGRPCError(e.Cause())
146-
}
147144
// codes.Canceled(1)
148145
// codes.Unknown(2)
149146
// codes.DeadlineExceeded(4)
@@ -168,10 +165,6 @@ func statusCodeFromDistributionError(err error) int {
168165
}
169166
case errcode.ErrorCoder:
170167
return errs.ErrorCode().Descriptor().HTTPStatusCode
171-
default:
172-
if e, ok := err.(causer); ok {
173-
return statusCodeFromDistributionError(e.Cause())
174-
}
175168
}
176169
return http.StatusInternalServerError
177170
}

0 commit comments

Comments
 (0)