aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-03-20 10:23:30 +0300
committerFrederick Muriuki Muriithi2023-03-20 10:23:30 +0300
commit6738e87abb68b5baa2fd7b040466738594d34df0 (patch)
tree80594c1ad826e10984ff330902707de35269f76d /wqflask
parentfa4c05ccae770b689a407e09c3c3f10dda188767 (diff)
downloadgenenetwork2-6738e87abb68b5baa2fd7b040466738594d34df0.tar.gz
corrs: Handle JSONDecodeError
In the case that the JSON output from the correlations computation is malformed, we capture that into a new exception an re-raise it to help with debugging and fixing issues.
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/views.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index f2d20eef..c71ae3c3 100644
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -901,9 +901,13 @@ def corr_compute_page():
return render_template("correlation_page.html", **output)
if jobs.completed_erroneously(job):
- ## The "parseable" error report is actually in STDOUT
- output = json.loads(job.get("stdout", "{}"))
- return render_template("correlation_error_page.html", error=output)
+ try:
+ ## The "parseable" error report is actually in STDOUT
+ output = json.loads(job.get("stdout") or "{}")
+ return render_template(
+ "correlation_error_page.html", error=output)
+ except json.decoder.JSONDecodeError as jde:
+ raise Exception(f"STDOUT: {job.get('stdout')}") from jde
return render_template("loading_corrs.html")