diff --git a/rest_log/components/service.py b/rest_log/components/service.py index 354bfe178..bbb45503f 100644 --- a/rest_log/components/service.py +++ b/rest_log/components/service.py @@ -17,6 +17,7 @@ from ..exceptions import ( RESTServiceDispatchException, + RESTServiceMissingErrorException, RESTServiceUserErrorException, RESTServiceValidationErrorException, ) @@ -43,6 +44,14 @@ def _dispatch_with_db_logging(self, method_name, *args, params=None): try: with self.env.cr.savepoint(): result = super().dispatch(method_name, *args, params=params) + except exceptions.MissingError as orig_exception: + self._dispatch_exception( + method_name, + RESTServiceMissingErrorException, + orig_exception, + *args, + params=params, + ) except exceptions.ValidationError as orig_exception: self._dispatch_exception( method_name, diff --git a/rest_log/exceptions.py b/rest_log/exceptions.py index 700cf6aa7..d2ebc0f9b 100644 --- a/rest_log/exceptions.py +++ b/rest_log/exceptions.py @@ -13,6 +13,12 @@ def __init__(self, message, log_entry_url): self.rest_json_info = {"log_entry_url": log_entry_url} +class RESTServiceMissingErrorException( + RESTServiceDispatchException, odoo_exceptions.MissingError +): + """Missing error wrapped exception.""" + + class RESTServiceUserErrorException( RESTServiceDispatchException, odoo_exceptions.UserError ):