-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: more expressive errors #22448
fix: more expressive errors #22448
Conversation
kit/transport/http/error_handler.go
Outdated
} else { | ||
msg = "An internal error has occurred" | ||
} | ||
msg = err.Error() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to keep An internal error has occurred
as a prefix for the returned message? Or is that just noise?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even with this, the client gives:
Error: failed to backup bucket data: failed to download snapshot of shard 1: download 1: InfluxDB OSS-only command failed: 500 Internal Server Error: error creating tsm hard link: forced error for "/Users/sarnold/.influxdbv2/engine/data/b029e667ccf6262d/autogen/1/000000001-000000001.tsm"
So since the changes will always be for 500 Internal server error
I'd say An internal error has occurred
is just noise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless we want to tag it as an error not in the expected format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something like unknown error type:
a581721
to
40ca5d5
Compare
Fixed linter complaint |
msg = err.Error() | ||
} else { | ||
msg = "An internal error has occurred" | ||
msg = "An internal error has occurred - check server logs" | ||
h.logger.Warn("internal error not returned to client", zap.Error(err)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dgnorton suggested (and I agree) it is probably too insecure to return any and every error back to the client. Instead, log the error and tell the client to check the server logs - anyone with server log access should have permission to see whatever errors we create.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Particular errors that we actually want to return to the client should be converted to the correct format to be returned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New error from client:
Error: failed to backup bucket data: failed to download snapshot of shard 1: InfluxDB OSS-only command failed: 500 Internal Server Error: An internal error has occurred - check server logs
From server logs:
2021-09-13T15:45:36.828559Z warn internal error not returned to client {"log_id": "0WZyCYXW000", "handler": "error_logger", "error": "error creating tsm hard link: hard coded failure for /Users/sarnold/.influxdbv2/engine/data/b029e667ccf6262d/autogen/1/000000015-000000002.tsm"}
Closes #22446
Instead of "internal server error", tell the client that the error is in the server logs, and actually put them there.