https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25039

Tomás Cohen Arazi <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |Needs Signoff

--- Comment #7 from Tomás Cohen Arazi <[email protected]> ---
(In reply to Jonathan Druart from comment #2)
>
> +    else {
> +        Koha::Exceptions::WrongParameter->throw(
> +            "'days' must be an integer"
> +        ) unless looks_like_number($days);
> +        $due_date->add( days => $days );
>
> Developers will get an error anyway if $days is not an integer (DateTime
> will raise its own meaningful exception), or $hard_due_date is not a
> DateTime.

I tried removing the checks, and the results are not cool:

- Removing the check for DateTime object => found: Can't locate object method
"clone" via package "cat" (perhaps you forgot to load "cat"?) at
/kohadevbox/koha/Koha/Checkout.pm line 190.

- Removing the check for number => found: normal exit, and a simple warning:
Argument "dog" isn't numeric in addition (+) at
/usr/lib/x86_64-linux-gnu/perl5/5.24/DateTime/Duration.pm line 74.

So, from the developer POV, in this particular cases, I still think my patch is
better with the checks than not having them. I agree on something: It is boring
to code this much for a small feature. But I would do it like this anyway.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to