View | Details | Raw Unified | Return to bug 28907
Collapse All | Expand All

(-)a/Koha/Exceptions/REST.pm (+6 lines)
Lines 8-13 use Exception::Class ( Link Here
8
    'Koha::Exceptions::REST' => {
8
    'Koha::Exceptions::REST' => {
9
        isa => 'Koha::Exception',
9
        isa => 'Koha::Exception',
10
    },
10
    },
11
    'Koha::Exceptions::REST::Public::Authentication::Required' => {
12
        description => "This public route requires authentication",
13
    },
14
    'Koha::Exceptions::REST::Public::Unauthorized' => {
15
        description => "Unprivileged user cannot access another user's resources",
16
    },
11
    'Koha::Exceptions::REST::Query::InvalidOperator' => {
17
    'Koha::Exceptions::REST::Query::InvalidOperator' => {
12
        description => "Invalid operator found in query",
18
        description => "Invalid operator found in query",
13
        fields      => ['operator']
19
        fields      => ['operator']
(-)a/Koha/REST/Plugin/Exceptions.pm (-1 / +17 lines)
Lines 68-73 sub register { Link Here
68
                    }
68
                    }
69
                );
69
                );
70
            }
70
            }
71
            elsif ( blessed $exception
72
                && ref($exception) eq 'Koha::Exceptions::REST::Public::Authentication::Required' )
73
            {
74
                return $c->render(
75
                    status => 401,
76
                    json   => {
77
                        error => $exception->error,
78
                    }
79
                );
80
            } elsif ( blessed $exception && ref($exception) eq 'Koha::Exceptions::REST::Public::Unauthorized' ) {
81
                return $c->render(
82
                    status => 403,
83
                    json   => {
84
                        error => $exception->error,
85
                    }
86
                );
87
            }
71
88
72
            if ( blessed $exception ) {
89
            if ( blessed $exception ) {
73
                $type = "(" . ref($exception) . ")";
90
                $type = "(" . ref($exception) . ")";
74
- 

Return to bug 28907