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
2323 "net/http"
2424
2525 "github.com/minio/minio/cmd/crypto"
26+ "github.com/minio/minio/cmd/logger"
2627 "github.com/minio/minio/pkg/auth"
2728 "github.com/minio/minio/pkg/dns"
2829 "github.com/minio/minio/pkg/event"
@@ -1440,7 +1441,7 @@ var errorCodeResponse = map[APIErrorCode]APIError{ · 1411 unmodified lines
14401441 // toAPIErrorCode - Converts embedded errors. Convenience
14411442 // function written to handle all cases where we have known types of
14421443 // errors returned by underlying layers.
1443−func toAPIErrorCode(err error) (apiErr APIErrorCode) {
1444+func toAPIErrorCode(ctx context.Context, err error) (apiErr APIErrorCode) {
14441445 if err == nil {
14451446 return ErrNone
14461447 }
@@ -1767,6 +1768,10 @@ func toAPIErrorCode(err error) (apiErr APIErrorCode) { · 320 unmodified lines
17671768 apiErr = ErrObjectTampered
17681769 default:
17691770 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)
17701775 }
17711776
17721777 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