History

make the crypto error type a native go type (#8267)

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

Andreas Auernhammer committed 7 years ago

Commit ffded5a1 parent 11272935 files · +29 −23Browse files

Showing the changes to cmd/api-errors.go (1 of 5 files). Show all

Unified · Split

cmd/api-errors.go+6−0
@@ -1723,6 +1723,12 @@ func toAPIError(ctx context.Context, err error) APIError { · 1722 unmodified lines
17231723 // their internal error types. This code is only
17241724 // useful with gateway implementations.
17251725 switch e := err.(type) {
1726+ case crypto.Error:
1727+ apiErr = APIError{
1728+ Code: "XKMSInternalError",
1729+ Description: e.Error(),
1730+ HTTPStatusCode: http.StatusBadRequest,
1731+ }
17261732 case minio.ErrorResponse:
17271733 apiErr = APIError{
17281734 Code: e.Code,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t