Skip to content

Commit

Permalink
If the error message happens to be empty, it will break serailization. (
Browse files Browse the repository at this point in the history
  • Loading branch information
Omer Lachish committed Feb 9, 2020
1 parent 5afc94c commit c961c33
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion redash/serializers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ def serialize_job(job):
updated_at = 0

status = STATUSES[job_status]
query_result_id = None

if isinstance(job.result, Exception):
error = str(job.result)
Expand All @@ -292,13 +293,14 @@ def serialize_job(job):
error = "Query execution cancelled."
else:
error = ""
query_result_id = job.result

return {
"job": {
"id": job.id,
"updated_at": updated_at,
"status": status,
"error": error,
"query_result_id": job.result if job.is_finished and not error else None,
"query_result_id": query_result_id,
}
}

0 comments on commit c961c33

Please sign in to comment.