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

(-)a/Koha/REST/Plugin/Exceptions.pm (-3 / +1 lines)
Lines 18-24 package Koha::REST::Plugin::Exceptions; Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Scalar::Util qw( blessed );
20
use Scalar::Util qw( blessed );
21
use Koha::Logger;
22
21
23
use Mojo::Base 'Mojolicious::Plugin';
22
use Mojo::Base 'Mojolicious::Plugin';
24
23
Lines 69-76 sub register { Link Here
69
68
70
            my $message = "$method $path: unhandled exception $type\<\<$exception_string\>\>";
69
            my $message = "$method $path: unhandled exception $type\<\<$exception_string\>\>";
71
70
72
            my $logger = Koha::Logger->get({ interface => 'api' });
71
            $c->app->log->error( "$message" );
73
            $logger->error("$message");
74
72
75
            $c->render(
73
            $c->render(
76
                status  => 500,
74
                status  => 500,
(-)a/Koha/REST/Plugin/PluginRoutes.pm (-6 / +3 lines)
Lines 21-27 use Mojo::Base 'Mojolicious::Plugin'; Link Here
21
21
22
use Koha::Exceptions::Plugin;
22
use Koha::Exceptions::Plugin;
23
use Koha::Plugins;
23
use Koha::Plugins;
24
use Koha::Logger;
25
24
26
use Clone qw( clone );
25
use Clone qw( clone );
27
use JSON::Validator::Schema::OpenAPIv2;
26
use JSON::Validator::Schema::OpenAPIv2;
Lines 57-63 sub register { Link Here
57
        );
56
        );
58
57
59
        foreach my $plugin ( @plugins ) {
58
        foreach my $plugin ( @plugins ) {
60
            $spec = $self->inject_routes( $spec, $plugin, $validate );
59
            $spec = $self->inject_routes( $spec, $plugin, $validate, $app->log );
61
        }
60
        }
62
61
63
    }
62
    }
Lines 70-76 sub register { Link Here
70
=cut
69
=cut
71
70
72
sub inject_routes {
71
sub inject_routes {
73
    my ( $self, $spec, $plugin, $validate ) = @_;
72
    my ( $self, $spec, $plugin, $validate, $logger ) = @_;
74
73
75
    return merge_spec( $spec, $plugin ) unless $validate;
74
    return merge_spec( $spec, $plugin ) unless $validate;
76
75
Lines 91-98 sub inject_routes { Link Here
91
    catch {
90
    catch {
92
        my $error = $_;
91
        my $error = $_;
93
        my $class = ref $plugin;
92
        my $class = ref $plugin;
94
        my $logger = Koha::Logger->get({ interface => 'api' });
93
        $logger->error( "Plugin $class route injection failed: $error" );
95
        $logger->error("Plugin $class route injection failed: $error");
96
        return $spec;
94
        return $spec;
97
    };
95
    };
98
}
96
}
99
- 

Return to bug 22678