This commit makes the `crypto.Error` type a native go (string) type. That allows us to define error values as constants instead of variables. For reference see: - https://twitter.com/_aead_/status/1118170258215514115?s=20 - https://dave.cheney.net/2016/04/07/constant-errors
Showing the changes to cmd/api-errors.go (1 of 5 files). Show all
Unified · Split
| @@ -1723,6 +1723,12 @@ func toAPIError(ctx context.Context, err error) APIError { · 1722 unmodified lines | ||
| 1723 | 1723 | // their internal error types. This code is only |
| 1724 | 1724 | // useful with gateway implementations. |
| 1725 | 1725 | switch e := err.(type) { |
| 1726 | + case crypto.Error: | |
| 1727 | + apiErr = APIError{ | |
| 1728 | + Code: "XKMSInternalError", | |
| 1729 | + Description: e.Error(), | |
| 1730 | + HTTPStatusCode: http.StatusBadRequest, | |
| 1731 | + } | |
| 1726 | 1732 | case minio.ErrorResponse: |
| 1727 | 1733 | apiErr = APIError{ |
| 1728 | 1734 | Code: e.Code, |