Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][IMP] rest_log: add MissingError to dispatch method #491

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
try:
with self.env.cr.savepoint():
result = super().dispatch(method_name, *args, params=params)
except exceptions.MissingError as orig_exception:
self._dispatch_exception(

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

View check run for this annotation

Codecov / codecov/patch

rest_log/components/service.py#L48

Added line #L48 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
Loading