Skip to content
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

Include error code and name on error message #98

Closed
wants to merge 1 commit into from

Conversation

deigote
Copy link
Member

@deigote deigote commented Oct 26, 2023

Ideally we'd expose the error info in a structured way like suggested in #97 . Since that's more involved as requires changing exported interfaces, in the meantime having the info in the error message might be already helpful for telemetry.

Ideally we'd expose the error info in a structured way like suggested in trinodb#97 . Since that's more involved as requires changing exported interfaces, in the meantime having the info in the error message might be already helpful for telemetry.
@cla-bot
Copy link

cla-bot bot commented Oct 26, 2023

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@@ -725,7 +725,7 @@ type stmtErrorFailureInfo struct {
}

func (e stmtError) Error() string {
return e.FailureInfo.Type + ": " + e.Message
return fmt.Sprintf("%v (name: %s, code: %d): %s", e.FailureInfo.Type, e.ErrorName, e.ErrorCode, e.Message)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a simple test for that? Maybe a query with a syntax error? I'd like to see some example value and make sure it's human-readable and informative.

We should not encourage parsing this string and instead fix the interfaces as suggested in #97.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can do, but wouldn't a test encourage folk to rely on the message as if it was some sort of contract 🤔 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. I asked for it to have increased coverage and a good example of what's expected there.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PTAL at #109, maybe it solves getting error details without having to parse the error string.

@nineinchnick
Copy link
Member

@deigote I'll close this since we got #97 merged. Feel free to reopen this or create a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants