Skip to content

Commit

Permalink
[IMP] rest_log: add MissingError to dispatch method
Browse files Browse the repository at this point in the history
  • Loading branch information
renda-dev committed Feb 14, 2024
1 parent e8ce615 commit e591bd9
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 @@ -16,6 +16,7 @@

from ..exceptions import (
RESTServiceDispatchException,
RESTServiceMissingErrorException,
RESTServiceUserErrorException,
RESTServiceValidationErrorException,
)
Expand All @@ -41,6 +42,14 @@ def _dispatch_with_db_logging(self, method_name, *args, params=None):
# https://github.com/OCA/rest-framework/pull/106#pullrequestreview-582099258
try:
result = super().dispatch(method_name, *args, params=params)
except exceptions.MissingError as orig_exception:
self._dispatch_exception(

Check warning on line 46 in rest_log/components/service.py

View check run for this annotation

Codecov / codecov/patch

rest_log/components/service.py#L46

Added line #L46 was not covered by tests
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 e591bd9

Please sign in to comment.