mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 17:38:54 +00:00
Merge pull request #1601 from aslotnick/1529_presto_error_message
[Presto] Change: better formatted error messages
This commit is contained in:
commit
9c0f0cb044
@ -10,6 +10,7 @@ from collections import defaultdict
|
||||
|
||||
try:
|
||||
from pyhive import presto
|
||||
from pyhive.exc import DatabaseError
|
||||
enabled = True
|
||||
|
||||
except ImportError:
|
||||
@ -112,6 +113,11 @@ class Presto(BaseQueryRunner):
|
||||
data = {'columns': columns, 'rows': rows}
|
||||
json_data = json.dumps(data, cls=JSONEncoder)
|
||||
error = None
|
||||
except DatabaseError, db:
|
||||
json_data = None
|
||||
default_message = 'Unspecified DatabaseError: {0}'.format(db.message)
|
||||
message = db.message.get('failureInfo', {'message', None}).get('message')
|
||||
error = default_message if message is None else message
|
||||
except Exception, ex:
|
||||
json_data = None
|
||||
error = ex.message
|
||||
|
Loading…
Reference in New Issue
Block a user