KurtYoung commented on a change in pull request #11397: [FLINK-16217] 
[sql-client] catch all exceptions to avoid SQL client crashed
URL: https://github.com/apache/flink/pull/11397#discussion_r410698384
 
 

 ##########
 File path: 
flink-table/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliClient.java
 ##########
 @@ -196,8 +196,12 @@ public void open() {
                        if (line == null) {
                                continue;
                        }
-                       final Optional<SqlCommandCall> cmdCall = 
parseCommand(line);
-                       cmdCall.ifPresent(this::callCommand);
+                       try {
+                               final Optional<SqlCommandCall> cmdCall = 
parseCommand(line);
+                               cmdCall.ifPresent(this::callCommand);
+                       } catch (Throwable t) {
 
 Review comment:
   +1 to catch everything here. Even we are able to wrap all exceptions into 
`SqlExecutionException`, there still would be some unexpected errors, like NPE 
or something like that. There is no real harm for catching everything here, 
users still can see the error messages from console, knowing something went 
wrong. 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to