summaryrefslogtreecommitdiff
path: root/opendc/models/model.py
diff options
context:
space:
mode:
authorGeorgios Andreadis <info@gandreadis.com>2020-06-26 12:27:51 +0200
committerGeorgios Andreadis <info@gandreadis.com>2020-06-26 12:27:51 +0200
commit19bede4fc7f7320bb4eb16c3fe1a211b19ab4714 (patch)
tree6a53629feb7bd8c7a9380d204287f3429ed2f378 /opendc/models/model.py
parent92b94b59ad80329a2c99471edbf5bbdc9af1e525 (diff)
Revamp error responses everywhere
Diffstat (limited to 'opendc/models/model.py')
-rw-r--r--opendc/models/model.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/opendc/models/model.py b/opendc/models/model.py
index d0bf34ee..2505ae61 100644
--- a/opendc/models/model.py
+++ b/opendc/models/model.py
@@ -1,4 +1,5 @@
from opendc.util.database import DB
+from opendc.util.exceptions import ClientError
from opendc.util.rest import Response
@@ -12,11 +13,9 @@ class Model:
def __init__(self, obj):
self.obj = obj
- def validate(self, request_google_id=None):
+ def check_exists(self):
if self.obj is None:
- return Response(404, 'Not found.')
-
- return None
+ raise ClientError(Response(404, 'Not found.'))
def set_property(self, key, value):
self.obj[key] = value