Bug 27833: Make K::P::Attribute add the object to the exception
This patch makes the 'check_unique_id' and '_check_repeatable' methods pass the 'attribute' parameter when throwing an exception. This way we can provid emore meaningfull error messages. To test: 1. Apply the previous patches 2. Run $ kshell k$ prove t/db_dependent/Koha/Patron/Attributes.t => FAIL: The exceptions are not passed the attribute! 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! 5. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
e43ce6cc7f
commit
35aefaa11c
|
|
@ -148,7 +148,7 @@ sub _check_repeatable {
|
|||
code => $self->code
|
||||
}
|
||||
)->count;
|
||||
Koha::Exceptions::Patron::Attribute::NonRepeatable->throw()
|
||||
Koha::Exceptions::Patron::Attribute::NonRepeatable->throw( attribute => $self )
|
||||
if $attr_count > 0;
|
||||
}
|
||||
|
||||
|
|
@ -176,7 +176,7 @@ sub check_unique_id {
|
|||
my $unique_count = Koha::Patron::Attributes
|
||||
->search( $params )
|
||||
->count;
|
||||
Koha::Exceptions::Patron::Attribute::UniqueIDConstraint->throw()
|
||||
Koha::Exceptions::Patron::Attribute::UniqueIDConstraint->throw( attribute => $self )
|
||||
if $unique_count > 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue