aboutsummaryrefslogtreecommitdiffstats
path: root/gui/api/__init__.py
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-09-25 12:41:41 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-09-25 12:41:41 +0200
commite84f532b9e97dc2ad53ad96cc9543a178d6f20fd (patch)
treeedcf5bd3290e18597e02cbde77f78b4329d5d95b /gui/api/__init__.py
parentd5afedae5f31a6b4c8052b12af9279e609ac5f20 (diff)
downloaddabmod-e84f532b9e97dc2ad53ad96cc9543a178d6f20fd.tar.gz
dabmod-e84f532b9e97dc2ad53ad96cc9543a178d6f20fd.tar.bz2
dabmod-e84f532b9e97dc2ad53ad96cc9543a178d6f20fd.zip
gui: add input to RC page, improve predistortion page
Diffstat (limited to 'gui/api/__init__.py')
-rwxr-xr-xgui/api/__init__.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/gui/api/__init__.py b/gui/api/__init__.py
index 74f5feb..cef81c6 100755
--- a/gui/api/__init__.py
+++ b/gui/api/__init__.py
@@ -33,7 +33,7 @@ import datetime
def send_ok(data):
return json.dumps({'status' : 'ok', 'data': data}).encode()
-def send_error(data, reason=""):
+def send_error(reason=""):
return json.dumps({'status' : 'error', 'reason': reason}).encode()
class API:
@@ -72,7 +72,10 @@ class API:
def trigger_capture(self, **kwargs):
if cherrypy.request.method == 'POST':
cherrypy.response.headers["Content-Type"] = "application/json"
- return send_ok(self.dpd.capture_samples())
+ try:
+ return send_ok(self.dpd.capture_samples())
+ except ValueError as e:
+ return send_error(str(e))
else:
cherrypy.response.headers["Content-Type"] = "application/json"
cherrypy.response.status = 400