https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37895
--- Comment #5 from Kyle M Hall <[email protected]> --- (In reply to Julian Maurice from comment #3) > Shouldn't we add `use Try::Tiny` at the beginning ? It doesn't seem to be needed as we include it farther upstream from where we execute atomic updates. Should I include it explicitly in updatedatabase.pl just to have it there? > By the way, how does this work with Perl builtin try/catch which is not > experimental since 5.40 ? Has anyone tried ? > IIUC it's not enabled by default but can be enabled using `perl -E ...` > which I sometimes use. Looks like it would require modification as the built in feature uses the syntax from Syntax::Keyword::Try which doesn't appear to utilize $_ if I read that correctly > > Also curious about why SQL14's example treats the error in finally instead > of catch. Is this the recommended way to deal with exceptions (and if so, do > you know why ?) or can we use catch ? There is no keyword that triggers if no exception occurs. We could do something like: try { $dbh->do(q{}); } catch { say_failure( $out, "Database modification failed with errors: $_" ); } finally { say_success( $out, "Database modification was successful!" ) unless @_; } I feel like that is somewhat less readable than what was been proposed in the patch but I am open to changes you feel that is better. -- 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/
