Repository: zeppelin Updated Branches: refs/heads/branch-0.6 72d397235 -> 08a3ea21d
[ZEPPELIN-1127] Show error message in case of exception with JDBC ### What is this PR for? When there is exception while executeSql in JDBC interpreter, only stack trace is sent back to UI, it should include e.getMessage() as well. ### What type of PR is it? [Improvement] ### What is the Jira issue? * [ZEPPELIN-1127](https://issues.apache.org/jira/browse/ZEPPELIN-1127) ### How should this be tested? Create a paragraph, and write following and try to run ``` %phoenix select * from a_table_not_there ``` You should see below, followed by stack trace ``` ERROR 1012 (42M03): Table undefined. tableName=A_TABLE_NOT_THERE ``` ### Questions: * Does the licenses files need update? no * Is there breaking changes for older versions? no * Does this needs documentation? no Author: Prabhjyot Singh <[email protected]> Closes #1142 from prabhjyotsingh/ZEPPELIN-1127 and squashes the following commits: 9fcc53c [Prabhjyot Singh] Show error message in case of exception with JDBC (cherry picked from commit b84ae60f1334ac419c8286b4096a2c36564c2ea9) Signed-off-by: Prabhjyot Singh <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/08a3ea21 Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/08a3ea21 Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/08a3ea21 Branch: refs/heads/branch-0.6 Commit: 08a3ea21dceedf8baef440cf1549afefff25f6d7 Parents: 72d3972 Author: Prabhjyot Singh <[email protected]> Authored: Thu Jul 7 12:54:11 2016 +0530 Committer: Prabhjyot Singh <[email protected]> Committed: Fri Jul 8 21:51:30 2016 +0530 ---------------------------------------------------------------------- jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/zeppelin/blob/08a3ea21/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java ---------------------------------------------------------------------- diff --git a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java index 6312e28..34e91d7 100644 --- a/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java +++ b/jdbc/src/main/java/org/apache/zeppelin/jdbc/JDBCInterpreter.java @@ -364,7 +364,9 @@ public class JDBCInterpreter extends Interpreter { } catch (Exception e) { logger.error("Cannot run " + sql, e); - StringBuilder stringBuilder = new StringBuilder(e.getClass().toString()).append("\n"); + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(e.getMessage()).append("\n"); + stringBuilder.append(e.getClass().toString()).append("\n"); stringBuilder.append(StringUtils.join(e.getStackTrace(), "\n")); return new InterpreterResult(Code.ERROR, stringBuilder.toString()); }
