I was working on bug 20580 and noticed that the exceptions are not stringified and so not really useful when displayed in string context.
Created attachment 74246 [details] [review] Bug 20590: Improve Koha::Exceptions in string context I was working on bug 20580 and noticed that the exceptions are not stringified and so not really useful when displayed in string context. This patch is for discussion and not ready for inclusion Still need to fix: Koha/REST/V1/Patrons.pm (The error is "Given xxx does not exist") Koha/Object.pm: in ->store, Koha::Exceptions::Object::FKConstraint is raised but we cannot set 'value' Another note: In Koha::Exceptions::Exception I do not have access to $self->line_number and $self->filename See also http://search.cpan.org/~drolsky/Exception-Class-1.44/lib/Exception/Class/Base.pm#OVERRIDING_THE_as_string_METHOD Test plan: Apply patch from bug 20580 and execute create_superlibrarian.pl with an invalid categorycode
Hi guys, It seems that our exception classes have few issues. Could you take a look at this patch and give feedbacks?
Created attachment 74556 [details] [review] Bug 20590: Koha::Exceptions::Exception
Created attachment 74560 [details] [review] Bug 20590: Improve Koha::Exceptions in string context I was working on bug 20580 and noticed that the exceptions are not stringified and so not really useful when displayed in string context. This patch is for discussion and not ready for inclusion Still need to fix: Koha/REST/V1/Patrons.pm (The error is "Given xxx does not exist") Koha/Object.pm: in ->store, Koha::Exceptions::Object::FKConstraint is raised but we cannot set 'value' Another note: In Koha::Exceptions::Exception I do not have access to $self->line_number and $self->filename See also http://search.cpan.org/~drolsky/Exception-Class-1.44/lib/Exception/Class/Base.pm#OVERRIDING_THE_as_string_METHOD Test plan: Apply patch from bug 20580 and execute create_superlibrarian.pl with an invalid categorycode Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 74561 [details] [review] Bug 20590: Koha::Exceptions::Exception Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 74562 [details] [review] Bug 20590: Unit tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 74563 [details] [review] Bug 20590: Include Koha::Exceptions::Exception This patch makes Koha::Exceptions::Object include Koha::Exceptions::Exception so it is not required to include it excplicitly for using this exceptions. To test: - Run: $ kshell $k prove t/Koha/Exceptions.t => FAIL: Tests fail because Koha::Exceptions::Exception is not (implicitly or explicitly included) - Apply this patch - Run k$ prove t/Koha/Exceptions.t => SUCCESS: Tests pass! Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Pushed to master for 18.05, thanks Tomas!
Created attachment 74583 [details] [review] Bug 20590: Fix unit test
Created attachment 74639 [details] [review] Bug 20590: Fix Members.t Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
I choose not to backport to 17.11.x, too big and complex