use Modern::Perl;
use Exception::Class (
- 'Koha::Exceptions::Koha::Patron::Modification::DuplicateVerificationToken' => {
- isa => 'Koha::Exceptions::Object',
- description => "The verification token given already exists",
+
+ 'Koha::Exceptions::Patron::Modification' => {
+ description => 'Something went wrong'
},
+ 'Koha::Exceptions::Patron::Modification::DuplicateVerificationToken' => {
+ isa => 'Koha::Exceptions::Patron::Modification',
+ description => "The verification token given already exists"
+ }
);
1;
if ( $self->verification_token ) {
if ( Koha::Patron::Modifications->search( { verification_token => $self->verification_token } )->count() ) {
- Koha::Exceptions::Koha::Patron::Modification::DuplicateVerificationToken->throw;
+ Koha::Exceptions::Patron::Modification::DuplicateVerificationToken->throw(
+ "Duplicate verification token " . $self->verification_token
+ );
}
}
#!/usr/bin/perl
use Modern::Perl;
-use Test::More tests => 9;
+use Test::More tests => 10;
use Try::Tiny;
use t::lib::TestBuilder;
}
)->store();
} catch {
- ok( $_->isa('Koha::Exceptions::Koha::Patron::Modification::DuplicateVerificationToken'),
+ ok( $_->isa('Koha::Exceptions::Patron::Modification::DuplicateVerificationToken'),
'Attempting to add a duplicate verification token to the database should raise a Koha::Exceptions::Koha::Patron::Modification::DuplicateVerificationToken exception' );
+ is( $_->message, "Duplicate verification token 1234567890", 'Exception carries the right message' );
};
## Get the new pending modification