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

(-)a/Koha/Exceptions/Object.pm (+4 lines)
Lines 92-97 sub full_message { Link Here
92
        }
92
        }
93
    }
93
    }
94
94
95
    if ( !$msg ) {
96
        return $self->SUPER::full_message;
97
    }
98
95
    return $msg;
99
    return $msg;
96
}
100
}
97
101
(-)a/t/Koha/Exceptions.t (-2 / +28 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::NoWarnings;
20
use Test::NoWarnings;
21
use Test::More tests => 13;
21
use Test::More tests => 14;
22
use Test::MockObject;
22
use Test::MockObject;
23
use Test::Exception;
23
use Test::Exception;
24
24
Lines 427-429 subtest 'Passing parameters when throwing exception' => sub { Link Here
427
    like( $desc, qr/type => ARRAY/,         'Found type' );
427
    like( $desc, qr/type => ARRAY/,         'Found type' );
428
    like( $desc, qr/value => ARRAY\(\w+\)/, 'Found value' );
428
    like( $desc, qr/value => ARRAY\(\w+\)/, 'Found value' );
429
};
429
};
430
- 
430
431
subtest 'full_message() should provide all the details' => sub {
432
    plan tests => 6;
433
434
    use Koha::Exceptions::Object;
435
436
    throws_ok {
437
        Koha::Exceptions::Object::DuplicateID->throw(
438
            duplicate_id => 'test_id',
439
            message      => 'the message',
440
        );
441
    }
442
    'Koha::Exceptions::Object::DuplicateID';
443
444
    like( $@->full_message, qr/the message/, 'Found the message' );
445
    unlike( $@->full_message, qr/test_id/, 'The message hides the original details' );
446
447
    throws_ok {
448
        Koha::Exceptions::Object::DuplicateID->throw(
449
            duplicate_id => 'test_id',
450
        );
451
    }
452
    'Koha::Exceptions::Object::DuplicateID';
453
454
    like( $@->full_message, qr/DuplicateID/, 'Found exception type' );
455
    like( $@->full_message, qr/test_id/,     'The message hides the original details' );
456
};

Return to bug 41694