Skip to content

Commit

Permalink
hive_ds: show a user friendly error message when possible (getredash#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sphenlee authored and harveyrendell committed Nov 14, 2019
1 parent 2346202 commit 075fb84
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions redash/query_runner/hive_ds.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

try:
from pyhive import hive
from pyhive.exc import DatabaseError
from thrift.transport import THttpClient
enabled = True
except ImportError:
Expand Down Expand Up @@ -129,6 +130,12 @@ def run_query(self, query, user):
connection.cancel()
error = "Query cancelled by user."
json_data = None
except DatabaseError as e:
try:
error = e.args[0].status.errorMessage
except AttributeError:
error = str(e)
json_data = None
finally:
if connection:
connection.close()
Expand Down

0 comments on commit 075fb84

Please sign in to comment.