Skip to content

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

@Glignos

Description

@Glignos

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions