Skip to content

Commit

Permalink
Merge PR #491 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by lmignon
  • Loading branch information
OCA-git-bot committed Jan 30, 2025
2 parents b8dd3a4 + e378832 commit b9fb0d7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions rest_log/components/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

from ..exceptions import (
RESTServiceDispatchException,
RESTServiceMissingErrorException,
RESTServiceUserErrorException,
RESTServiceValidationErrorException,
)
Expand All @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions rest_log/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
):
Expand Down

0 comments on commit b9fb0d7

Please sign in to comment.