View | Details | Raw Unified | Return to bug 26145
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 89-95 sub inject_routes { Link Here
89
    catch {
90
    catch {
90
        my $error = $_;
91
        my $error = $_;
91
        my $class = ref $plugin;
92
        my $class = ref $plugin;
92
        warn "Plugin $class route injection failed: $error";
93
        my $logger = Koha::Logger->get({ interface => 'api' });
94
        $logger->error("Plugin $class route injection failed: $error");
93
        return $spec;
95
        return $spec;
94
    };
96
    };
95
}
97
}
(-)a/Koha/REST/V1.pm (-4 / +5 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 102-110 sub startup { Link Here
102
    catch {
103
    catch {
103
        # Validation of the complete spec failed. Resort to validation one-by-one
104
        # Validation of the complete spec failed. Resort to validation one-by-one
104
        # to catch bad ones.
105
        # to catch bad ones.
105
        
106
106
        # JSON::Validator uses confess, so trim call stack from the message.
107
        # JSON::Validator uses confess, so trim call stack from the message.
107
        carp "Warning: Could not load REST API spec bundle: " . ($_ =~ /\A(.*?)$/ms)[0]; 
108
        my $logger = Koha::Logger->get({ interface => 'api' });
109
        $logger->error("Warning: Could not load REST API spec bundle: " . $_);
108
110
109
        try {
111
        try {
110
            $validator->load_and_validate_schema(
112
            $validator->load_and_validate_schema(
Lines 135-141 sub startup { Link Here
135
        }
137
        }
136
        catch {
138
        catch {
137
            # JSON::Validator uses confess, so trim call stack from the message.
139
            # JSON::Validator uses confess, so trim call stack from the message.
138
            croak "Could not load REST API spec: " . ($_ =~ /\A(.*?)$/ms)[0];
140
            $logger->error("Warning: Could not load REST API spec bundle: " . $_);
139
        };
141
        };
140
    };
142
    };
141
143
142
- 

Return to bug 26145