Skip to content

Commit

Permalink
Better error handling for presto
Browse files Browse the repository at this point in the history
  • Loading branch information
vera-liu committed Feb 15, 2017
1 parent acfe62e commit b5e330d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions superset/sql_lab.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@ def handle_error(msg):
result_proxy = engine.execute(query.executed_sql, schema=query.schema)
except Exception as e:
logging.exception(e)
if hasattr(e, 'orig') \
and type(e.orig).__name__ == 'DatabaseError' \
and isinstance(e.orig[0], dict):
error_dict = e.orig[0]
e = '{} at {}: {}'.format(
error_dict['errorName'],
error_dict['errorLocation'],
error_dict['message']
)
handle_error(utils.error_msg_from_exception(e))

cursor = result_proxy.cursor
Expand Down

0 comments on commit b5e330d

Please sign in to comment.