sohami commented on a change in pull request #1626: DRILL-6855: Query from
non-existent proxy user fails with "No default schema selected" when
impersonation is enabled
URL: https://github.com/apache/drill/pull/1626#discussion_r256120073
##########
File path:
common/src/main/java/org/apache/drill/common/exceptions/UserExceptionUtils.java
##########
@@ -0,0 +1,23 @@
+package org.apache.drill.common.exceptions;
+
+/**
+ * Provides utilities (such as retrieving hints) to add more context to
UserExceptions.
+ */
+public class UserExceptionUtils {
+ public static final String USER_DOES_NOT_EXIST =
+ "Username is absent in connection URL or doesn't exist on Drillbit
node." +
+ " Please specify a username in connection URL which is present on
Drillbit node.";
+
+ private static String decorateHint(final String text) {
+ return String.format("[Hint: %s]", text);
+ }
+ public static String getUserHint(final Throwable ex) {
+ if (ex.getMessage().startsWith("Error getting user info for current
user")) {
+ //User does not exist hint
+ return decorateHint(USER_DOES_NOT_EXIST);
+ } else {
+ //No hint can be provided
+ return "";
+ }
+ }
Review comment:
Since it's a utility class and contains only static methods/variables so
better to make the constructor private.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services