You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by js...@apache.org on 2015/02/27 09:02:00 UTC
[6/9] drill git commit: DRILL-1515: For the Web UI users,
if exception is thrown, users are redirected to another page,
which shows the error message
DRILL-1515: For the Web UI users, if exception is thrown, users are redirected to another page, which shows the error message
Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/aa7eb2a9
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/aa7eb2a9
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/aa7eb2a9
Branch: refs/heads/master
Commit: aa7eb2a927faf86a00de3dc0a3cd75862a90a8cc
Parents: 619c2fb
Author: Hsuan-Yi Chu <hs...@usc.edu>
Authored: Mon Jan 5 10:28:29 2015 -0800
Committer: Jason Altekruse <al...@gmail.com>
Committed: Thu Feb 26 16:41:03 2015 -0800
----------------------------------------------------------------------
.../drill/exec/server/rest/QueryResources.java | 9 ++++++--
.../main/resources/rest/query/errorMessage.ftl | 24 ++++++++++++++++++++
2 files changed, 31 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/drill/blob/aa7eb2a9/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryResources.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryResources.java b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryResources.java
index 9ef6676..145a476 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryResources.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryResources.java
@@ -68,8 +68,13 @@ public class QueryResources {
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@Produces(MediaType.TEXT_HTML)
public Viewable submitQuery(@FormParam("query") String query, @FormParam("queryType") String queryType) throws Exception {
- final QueryWrapper.QueryResult result = submitQueryJSON(new QueryWrapper(query, queryType));
- return new Viewable("/rest/query/result.ftl", new TabularResult(result));
+ try {
+ final QueryWrapper.QueryResult result = submitQueryJSON(new QueryWrapper(query, queryType));
+ return new Viewable("/rest/query/result.ftl", new TabularResult(result));
+ } catch(Exception | Error e) {
+ logger.error("Query from Web UI Failed", e);
+ return new Viewable("/rest/query/errorMessage.ftl", e);
+ }
}
public static class TabularResult {
http://git-wip-us.apache.org/repos/asf/drill/blob/aa7eb2a9/exec/java-exec/src/main/resources/rest/query/errorMessage.ftl
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/resources/rest/query/errorMessage.ftl b/exec/java-exec/src/main/resources/rest/query/errorMessage.ftl
new file mode 100644
index 0000000..dbdcc9e
--- /dev/null
+++ b/exec/java-exec/src/main/resources/rest/query/errorMessage.ftl
@@ -0,0 +1,24 @@
+<#-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to
+ You under the Apache License, Version 2.0 (the "License"); you may not use
+ this file except in compliance with the License. You may obtain a copy of
+ the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
+ by applicable law or agreed to in writing, software distributed under the
+ License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ OF ANY KIND, either express or implied. See the License for the specific
+ language governing permissions and limitations under the License. -->
+
+<#include "*/generic.ftl">
+<#macro page_head>
+</#macro>
+
+<#macro page_body>
+ <a href="/queries">back</a><br/>
+ <div class="page-header">
+ </div>
+ <h2> Query Failed: An Error Occurred </h2>
+ ${model}
+</#macro>
+
+<@page_html/>
\ No newline at end of file