From 19bede4fc7f7320bb4eb16c3fe1a211b19ab4714 Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Fri, 26 Jun 2020 12:27:51 +0200 Subject: Revamp error responses everywhere --- opendc/util/exceptions.py | 4 ++-- opendc/util/rest.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'opendc/util') diff --git a/opendc/util/exceptions.py b/opendc/util/exceptions.py index e73dad4f..2563c419 100644 --- a/opendc/util/exceptions.py +++ b/opendc/util/exceptions.py @@ -57,9 +57,9 @@ class MissingParameterError(ParameterError): self.parameter_location = parameter_location -class ClientRequestError(Exception): +class ClientError(Exception): """Raised when a 4xx response is to be returned.""" def __init__(self, response): - super(ClientRequestError, self).__init__(str(response)) + super(ClientError, self).__init__(str(response)) self.response = response diff --git a/opendc/util/rest.py b/opendc/util/rest.py index e70998a8..dc5478de 100644 --- a/opendc/util/rest.py +++ b/opendc/util/rest.py @@ -6,7 +6,7 @@ import sys from oauth2client import client, crypt from opendc.util import exceptions, parameter_checker -from opendc.util.exceptions import ClientRequestError +from opendc.util.exceptions import ClientError class Request(object): @@ -75,7 +75,7 @@ class Request(object): try: parameter_checker.check(self, **kwargs) except exceptions.ParameterError as e: - raise ClientRequestError(Response(400, str(e))) + raise ClientError(Response(400, str(e))) def process(self): """Process the Request and return a Response.""" @@ -84,7 +84,7 @@ class Request(object): try: response = method(self) - except ClientRequestError as e: + except ClientError as e: e.response.id = self.id return e.response -- cgit v1.2.3