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

Function return in pass_record should not be inside exception handler. #305

Open
Glignos opened this issue Aug 28, 2020 · 0 comments
Open

Comments

@Glignos
Copy link
Member

Glignos commented Aug 28, 2020

The return function of this wrapper should be outside the
try since the exception handling is solely for the resolving of the PID.
Instead the correct way to do it would be:

def inner(self, pid_value, *args, **kwargs):
        try:
            pid, record = request.view_args['pid_value'].data
        except SQLAlchemyError:
            raise PIDResolveRESTError(pid_value)
        return f(self, pid=pid, record=record, *args, **kwargs)
    return inner

After this change is performed the test test_delete_with_sqldatabase_error will start failing since the Exception is not handled then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant