From 831017092a040612f70a075eae9f841f193adc52 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Thu, 13 Apr 2023 11:17:44 -0400 Subject: [PATCH] sachet/server/views_common.py: add an extra error check on patch() --- sachet/server/views_common.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sachet/server/views_common.py b/sachet/server/views_common.py index 52453a6..b41e454 100644 --- a/sachet/server/views_common.py +++ b/sachet/server/views_common.py @@ -100,6 +100,13 @@ class ModelAPI(MethodView): return jsonify(model.get_schema().dump(model)) def patch(self, model): + if not model: + resp = { + "status": "fail", + "message": "This resource does not exist.", + } + return jsonify(resp), 404 + model_schema = model.get_schema() if not model: