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

(-)a/Koha/Exceptions/Plugin.pm (-4 / +4 lines)
Lines 35-46 use Exception::Class ( Link Here
35
    'Koha::Exceptions::Plugin::InstallDied' => {
35
    'Koha::Exceptions::Plugin::InstallDied' => {
36
        isa         => 'Koha::Exceptions::Plugin',
36
        isa         => 'Koha::Exceptions::Plugin',
37
        description => 'The plugin died on install',
37
        description => 'The plugin died on install',
38
        fields      => ['plugin_class'],
38
        fields      => [ 'plugin_class', 'install_error' ],
39
    },
39
    },
40
    'Koha::Exceptions::Plugin::UpgradeDied' => {
40
    'Koha::Exceptions::Plugin::UpgradeDied' => {
41
        isa         => 'Koha::Exceptions::Plugin',
41
        isa         => 'Koha::Exceptions::Plugin',
42
        description => 'The plugin died on upgrade',
42
        description => 'The plugin died on upgrade',
43
        fields      => ['plugin_class'],
43
        fields      => [ 'plugin_class', 'upgrade_error' ],
44
    },
44
    },
45
);
45
);
46
46
Lines 56-64 sub full_message { Link Here
56
                $self->plugin_name, $self->method
56
                $self->plugin_name, $self->method
57
            );
57
            );
58
        } elsif ( $self->isa('Koha::Exceptions::Plugin::InstallDied') ) {
58
        } elsif ( $self->isa('Koha::Exceptions::Plugin::InstallDied') ) {
59
            $msg = sprintf( "Calling 'install' died for plugin %s", $self->plugin_class );
59
            $msg = sprintf( "Calling 'install' died for plugin %s: %s", $self->plugin_class, $self->install_error );
60
        } elsif ( $self->isa('Koha::Exceptions::Plugin::UpgradeDied') ) {
60
        } elsif ( $self->isa('Koha::Exceptions::Plugin::UpgradeDied') ) {
61
            $msg = sprintf( "Calling 'upgrade' died for plugin %s", $self->plugin_class );
61
            $msg = sprintf( "Calling 'upgrade' died for plugin %s: %s", $self->plugin_class, $self->upgrade_error );
62
        }
62
        }
63
    }
63
    }
64
64
(-)a/t/Koha/Exceptions.t (-5 / +11 lines)
Lines 315-338 subtest 'Koha::Exceptions::Plugin tests' => sub { Link Here
315
    use_ok("Koha::Exceptions::Plugin");
315
    use_ok("Koha::Exceptions::Plugin");
316
316
317
    my $plugin_class = 'yahey';
317
    my $plugin_class = 'yahey';
318
    my $error_string = 'This is an error';
318
319
319
    throws_ok {
320
    throws_ok {
320
        Koha::Exceptions::Plugin::InstallDied->throw( plugin_class => $plugin_class );
321
        Koha::Exceptions::Plugin::InstallDied->throw(
322
            plugin_class  => $plugin_class,
323
            install_error => $error_string,
324
        );
321
    }
325
    }
322
    'Koha::Exceptions::Plugin::InstallDied',
326
    'Koha::Exceptions::Plugin::InstallDied',
323
        'Exception is thrown :-D';
327
        'Exception is thrown :-D';
324
328
325
    # stringify the exception
329
    # stringify the exception
326
    is( "$@", "Calling 'install' died for plugin $plugin_class", 'Exception stringified correctly' );
330
    is( "$@", "Calling 'install' died for plugin $plugin_class: $error_string", 'Exception stringified correctly' );
327
331
328
    throws_ok {
332
    throws_ok {
329
        Koha::Exceptions::Plugin::UpgradeDied->throw( plugin_class => $plugin_class );
333
        Koha::Exceptions::Plugin::UpgradeDied->throw(
334
            plugin_class  => $plugin_class,
335
            upgrade_error => $error_string,
336
        );
330
    }
337
    }
331
    'Koha::Exceptions::Plugin::UpgradeDied',
338
    'Koha::Exceptions::Plugin::UpgradeDied',
332
        'Exception is thrown :-D';
339
        'Exception is thrown :-D';
333
340
334
    # stringify the exception
341
    # stringify the exception
335
    is( "$@", "Calling 'upgrade' died for plugin $plugin_class", 'Exception stringified correctly' );
342
    is( "$@", "Calling 'upgrade' died for plugin $plugin_class: $error_string", 'Exception stringified correctly' );
336
};
343
};
337
344
338
subtest 'Koha::Exceptions::Booking tests' => sub {
345
subtest 'Koha::Exceptions::Booking tests' => sub {
339
- 

Return to bug 39632