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

(-)a/Koha/REST/Plugin/PluginRoutes.pm (-1 / +3 lines)
Lines 21-26 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;
24
25
25
use Clone qw(clone);
26
use Clone qw(clone);
26
use Try::Tiny;
27
use Try::Tiny;
Lines 91-97 sub inject_routes { Link Here
91
    catch {
92
    catch {
92
        my $error = $_;
93
        my $error = $_;
93
        my $class = ref $plugin;
94
        my $class = ref $plugin;
94
        warn "Plugin $class route injection failed: $error";
95
        my $logger = Koha::Logger->get({ interface => 'api' });
96
        $logger->error("Plugin $class route injection failed: $error");
95
        return $spec;
97
        return $spec;
96
    };
98
    };
97
}
99
}
(-)a/Koha/REST/V1.pm (-3 / +4 lines)
Lines 20-25 use Modern::Perl; Link Here
20
use Mojo::Base 'Mojolicious';
20
use Mojo::Base 'Mojolicious';
21
21
22
use C4::Context;
22
use C4::Context;
23
use Koha::Logger;
23
use Carp;
24
use Carp;
24
use JSON::Validator::OpenAPI::Mojolicious;
25
use JSON::Validator::OpenAPI::Mojolicious;
25
use Try::Tiny;
26
use Try::Tiny;
Lines 106-112 sub startup { Link Here
106
        # to catch bad ones.
107
        # to catch bad ones.
107
108
108
        # JSON::Validator uses confess, so trim call stack from the message.
109
        # JSON::Validator uses confess, so trim call stack from the message.
109
        carp "Warning: Could not load REST API spec bundle: " . ($_ =~ /\A(.*?)$/ms)[0];
110
        my $logger = Koha::Logger->get({ interface => 'api' });
111
        $logger->error("Warning: Could not load REST API spec bundle: " . $_);
110
112
111
        try {
113
        try {
112
            $validator->load_and_validate_schema(
114
            $validator->load_and_validate_schema(
Lines 138-144 sub startup { Link Here
138
        }
140
        }
139
        catch {
141
        catch {
140
            # JSON::Validator uses confess, so trim call stack from the message.
142
            # JSON::Validator uses confess, so trim call stack from the message.
141
            croak "Could not load REST API spec: " . ($_ =~ /\A(.*?)$/ms)[0];
143
            $logger->error("Warning: Could not load REST API spec bundle: " . $_);
142
        };
144
        };
143
    };
145
    };
144
146
145
- 

Return to bug 25504