Bug 17425: Make Koha::Object raise exceptions
authorTomas Cohen Arazi <tomascohen@theke.io>
Tue, 11 Oct 2016 09:52:12 +0000 (11:52 +0200)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 21 Oct 2016 17:37:50 +0000 (17:37 +0000)
commit71e7804d2c5b7576a86cfe2234cff34020742d77
tree1b74df67db40de18b626a41255a74725c8426587
parentff9937a137518feaa7bd7dfcb32d01965da58f91
Bug 17425: Make Koha::Object raise exceptions

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>
Koha/Exceptions/Object.pm [new file with mode: 0644]
Koha/Object.pm
t/db_dependent/Koha/Objects.t