History

Make sure to log unhandled errors always (#6784)

In many situations, while testing we encounter ErrInternalError, to reduce logging we have removed logging from quite a few places which is acceptable but when ErrInternalError occurs we should have a facility to log the corresponding error, this helps to debug Minio server.

Harshavardhana committed 8 years ago

Commit a55a2981 parent 2929c1818 files · +228 −225Browse files

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

Unified · Split

cmd/api-errors.go+6−1
@@ -23,6 +23,7 @@ import ( · 22 unmodified lines
23 "net/http"23 "net/http"
24 24
25 "github.com/minio/minio/cmd/crypto"25 "github.com/minio/minio/cmd/crypto"
26 "github.com/minio/minio/cmd/logger"
26 "github.com/minio/minio/pkg/auth"27 "github.com/minio/minio/pkg/auth"
27 "github.com/minio/minio/pkg/dns"28 "github.com/minio/minio/pkg/dns"
28 "github.com/minio/minio/pkg/event"29 "github.com/minio/minio/pkg/event"
@@ -1440,7 +1441,7 @@ var errorCodeResponse = map[APIErrorCode]APIError{ · 1411 unmodified lines
1440// toAPIErrorCode - Converts embedded errors. Convenience1441// toAPIErrorCode - Converts embedded errors. Convenience
1441// function written to handle all cases where we have known types of1442// function written to handle all cases where we have known types of
1442// errors returned by underlying layers.1443// errors returned by underlying layers.
1443func toAPIErrorCode(err error) (apiErr APIErrorCode) {1444func toAPIErrorCode(ctx context.Context, err error) (apiErr APIErrorCode) {
1444 if err == nil {1445 if err == nil {
1445 return ErrNone1446 return ErrNone
1446 }1447 }
@@ -1767,6 +1768,10 @@ func toAPIErrorCode(err error) (apiErr APIErrorCode) { · 320 unmodified lines
1767 apiErr = ErrObjectTampered1768 apiErr = ErrObjectTampered
1768 default:1769 default:
1769 apiErr = ErrInternalError1770 apiErr = ErrInternalError
1771 // Make sure to log the errors which we cannot translate
1772 // to a meaningful S3 API errors. This is added to aid in
1773 // debugging unexpected/unhandled errors.
1774 logger.LogIf(ctx, err)
1770 }1775 }
1771 1776
1772 return apiErr1777 return apiErr

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