|
|
@@ -1,4 +1,5 @@
|
|
|
import json
|
|
|
+from json import JSONDecodeError
|
|
|
from pathlib import Path
|
|
|
from typing import Any
|
|
|
import arklog
|
|
|
@@ -81,7 +82,10 @@ class NotchRouter(APIRouter):
|
|
|
@self.get("/simulation/")
|
|
|
async def simulation_notch(request: Request, query: str | None = Query(None)) -> Response:
|
|
|
"""Notch simulation request response for a simulated activity."""
|
|
|
- body = await request.json()
|
|
|
+ try:
|
|
|
+ body = await request.json()
|
|
|
+ except JSONDecodeError:
|
|
|
+ return JSONResponse(status_code=500, content={"ctrl": "error", "debug": "Could not parse json input."})
|
|
|
control = body.get("ctrl")
|
|
|
# The predefined activity expects the control to be on the cin or rep port.
|
|
|
if control not in ["cin"]:
|