You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/11/04 09:50:29 UTC

[GitHub] [shardingsphere] RaigorJiang commented on a change in pull request #13463: Improve error message for SQLException.

RaigorJiang commented on a change in pull request #13463:
URL: https://github.com/apache/shardingsphere/pull/13463#discussion_r742679804



##########
File path: shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactory.java
##########
@@ -125,4 +126,11 @@ public static MySQLErrPacket newInstance(final Exception cause) {
         }
         return new MySQLErrPacket(1, CommonErrorCode.UNKNOWN_EXCEPTION, cause.getMessage());
     }
+    
+    private static String getErrorMessage(final SQLException cause) {
+        if (null != cause.getNextException() && StringUtils.isBlank(cause.getMessage())) {
+            return cause.getNextException().getMessage();

Review comment:
       This does not need to be the tail of the link, just get a meaningful exception for user. 
   According to all the code of `setNextException`, it makes sense to start from the first next.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org