Repository: zeppelin Updated Branches: refs/heads/master a9d064c90 -> b84ae60f1
[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 Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/b84ae60f Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/b84ae60f Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/b84ae60f Branch: refs/heads/master Commit: b84ae60f1334ac419c8286b4096a2c36564c2ea9 Parents: a9d064c 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:01 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/b84ae60f/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 0464a0b..2da39d3 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()); }
