-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Use a simple class to sanitize JDBC exceptions and also log them #11843
Use a simple class to sanitize JDBC exceptions and also log them #11843
Conversation
The purpose of this is to sanitize JDBC errors, but can sanitize other errors if they implement SanitizableError Interface add a class to log errors and sanitize them added a simple test that tests out that the error gets sanitized add @nonnull annotation to serverconfig's ErrorResponseTransfromStrategy
…only log specific details This is so an end user gets relevant information but not too much info since they might now how many brokers they have
sql/src/main/java/org/apache/druid/sql/avatica/ErrorHandler.java
Outdated
Show resolved
Hide resolved
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.
Are all the exceptions that can be thrown by JDBC implements SanitizableException?
Thanks for the contribution. Having good, clean user error messages is great. Even better if they tell the user what's wrong so they know what to do to fix the issue. (SQL error, missing column, unsupported operation, or whatever.) On the other hand, it is vital that us developers be able to see the error. So, the original, unvarnished, detailed call stack, in all its gory detail, should be logged at some log level. Example, I make a change an introduce an accidental NPE in my branch. A test fails. I have to be able to see the stack trace to figure out what I botched up so I can fix it. Does this solution include that logging aspect? Edit: checked with the @TSFenwick, turns out we do log the errors, so this aspect is all good. |
added new error types that need to be sanitized also sanitize deprecated and unsupported exceptions.
add docs avoid blanket turning all exceptions into runtime exceptions
sql/src/main/java/org/apache/druid/sql/avatica/ErrorHandler.java
Outdated
Show resolved
Hide resolved
ugh Travis.... why won't you run! |
add more javadocs add support UOE sanitization
sql/src/main/java/org/apache/druid/sql/avatica/DruidStatement.java
Outdated
Show resolved
Hide resolved
sql/src/main/java/org/apache/druid/sql/avatica/DruidStatement.java
Outdated
Show resolved
Hide resolved
sql/src/test/java/org/apache/druid/sql/avatica/DruidAvaticaHandlerTest.java
Show resolved
Hide resolved
sql/src/main/java/org/apache/druid/sql/avatica/ErrorHandler.java
Outdated
Show resolved
Hide resolved
sql/src/main/java/org/apache/druid/sql/avatica/ErrorHandler.java
Outdated
Show resolved
Hide resolved
sql/src/main/java/org/apache/druid/sql/avatica/ErrorHandler.java
Outdated
Show resolved
Hide resolved
clean up bad formatting and commented code. add missed catch for NoSuchStatementException clean up comments for error handler and add comment explainging not wanting to santize avatica exceptions
add a class to sanitize JDBC related exceptions and also log them
added a simple test that tests out that the exception gets sanitized
Description
Created a simple class to handle logging errors and sanitizing them. This is to be able to sanitize JDBC exceptions.
explored two others ways of solving this.
DruidMeta
methods in a try catch to sanitize all the JDBC exceptions.also added
@NonNull
annotation forErrorResponseTransformStrategy
inServerConfig
's constructor.Key changed/added classes in this PR
ErrorHandler
This PR has: