Skip to content

Commit

Permalink
Merge pull request #1062 from getredash/fix_dql
Browse files Browse the repository at this point in the history
DynamoDB: Better exception handling
  • Loading branch information
arikfr committed May 18, 2016
2 parents 701035f + d4ae97a commit 1a1160e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions redash/query_runner/dynamodb_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
import logging
import sys


from redash.query_runner import *
from redash.utils import JSONEncoder

logger = logging.getLogger(__name__)

try:
from dql import Engine, FragmentEngine
from pyparsing import ParseException
enabled = True
except ImportError, e:
enabled = False
Expand Down Expand Up @@ -126,6 +128,9 @@ def run_query(self, query):
data = {'columns': columns, 'rows': rows}
json_data = json.dumps(data, cls=JSONEncoder)
error = None
except ParseException as e:
error = u"Error parsing query at line {} (column {}):\n{}".format(e.lineno, e.column, e.line)
json_data = None
except (SyntaxError, RuntimeError) as e:
error = e.message
json_data = None
Expand Down

0 comments on commit 1a1160e

Please sign in to comment.