Commit 4dc7a101 authored by cst's avatar cst
Browse files

handling if logger id does not exists

parent cca89882
......@@ -26,6 +26,9 @@ class LoggerPostHandler:
sp = Db.fetchone(sql, model)
if sp is None:
return None
for m in model["values"]:
v = {}
v["sampling_point_id"] = sp["id"]
......@@ -3,7 +3,7 @@ from web.helpers.user import User
from web.api.imports.observations.observations_post_handler import ObservationsPostHandler
from web.api.imports.observations.logger_post_handler import LoggerPostHandler
from web.helpers.model_binder import ModelBinder as Binder
from werkzeug.exceptions import InternalServerError
from werkzeug.exceptions import InternalServerError, BadRequest
from web.helpers.responses import Responses
......@@ -33,6 +33,10 @@ def logger_get():
obsModel = loggerHandler.handle(loggerModel)
if obsModel is None:
raise BadRequest(description="Logger id not found")
return Responses.plain("Created", 201)
except Exception as e:
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment