Skip to content

Commit e378832

Browse files
renda-devPicchiSeba
authored andcommitted
[IMP] rest_log: add MissingError to dispatch method
1 parent dbbfea0 commit e378832

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

rest_log/components/service.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from ..exceptions import (
1919
RESTServiceDispatchException,
20+
RESTServiceMissingErrorException,
2021
RESTServiceUserErrorException,
2122
RESTServiceValidationErrorException,
2223
)
@@ -43,6 +44,14 @@ def _dispatch_with_db_logging(self, method_name, *args, params=None):
4344
try:
4445
with self.env.cr.savepoint():
4546
result = super().dispatch(method_name, *args, params=params)
47+
except exceptions.MissingError as orig_exception:
48+
self._dispatch_exception(
49+
method_name,
50+
RESTServiceMissingErrorException,
51+
orig_exception,
52+
*args,
53+
params=params,
54+
)
4655
except exceptions.ValidationError as orig_exception:
4756
self._dispatch_exception(
4857
method_name,

rest_log/exceptions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ def __init__(self, message, log_entry_url):
1313
self.rest_json_info = {"log_entry_url": log_entry_url}
1414

1515

16+
class RESTServiceMissingErrorException(
17+
RESTServiceDispatchException, odoo_exceptions.MissingError
18+
):
19+
"""Missing error wrapped exception."""
20+
21+
1622
class RESTServiceUserErrorException(
1723
RESTServiceDispatchException, odoo_exceptions.UserError
1824
):

0 commit comments

Comments
 (0)