Browse Source
This patch makes Koha::Object raise exceptions in the following situations: - When a non existent accessor is called - When a non existent property is tried to be updated using ->set On implementing this change, we introduce Koha::Exceptions::Object class to contain all Koha::Object-specific exception definitions. Unit tests for this change are introduced in t/db_dependent/Koha/Objects.t To test: - Apply the patches on master - Run: $ prove t/db_dependent/Koha/Objects.t => SUCCESS: Tests return green - Sign off Note: A followup introduces the dependency for Try::Tiny. It needs to be present for running the tests. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>16.11.x
3 changed files with 50 additions and 7 deletions
@ -0,0 +1,20 @@ |
|||
package Koha::Exceptions::Object; |
|||
|
|||
use Modern::Perl; |
|||
|
|||
use Exception::Class ( |
|||
|
|||
'Koha::Exceptions::Object' => { |
|||
description => 'Something went wrong!', |
|||
}, |
|||
'Koha::Exceptions::Object::MethodNotFound' => { |
|||
isa => 'Koha::Exceptions::Object', |
|||
description => "Invalid method", |
|||
}, |
|||
'Koha::Exceptions::Object::PropertyNotFound' => { |
|||
isa => 'Koha::Exceptions::Object', |
|||
description => "Invalid property", |
|||
} |
|||
); |
|||
|
|||
1; |
Loading…
Reference in new issue