NAME

Catalyst::Seal::Exceptions - plain eval in place of Try::Tiny on the request path

DESCRIPTION

Catalyst wraps two things on every request in Try::Tiny: the whole of handle_request, and the engine calls inside prepare. Each try builds two closures, names them with set_subname, and dispatches through Try::Tiny::try's own prototype handling. Catalyst::execute already uses a plain eval for the same job.

The replacements below are the stock subroutines with try/catch rewritten as eval, and nothing else changed. They are a copy of Catalyst 5.90132, so a Catalyst that has rewritten either of them is a Catalyst these are stale for.

What has to survive

  • $@ is captured on the statement immediately after the eval, before anything else can run and clobber it.

  • The eval { ...; 1 } idiom decides success, not the truth of $@. Catalyst throws exception objects, and Catalyst::Exception::Detach and friends can overload boolean. Testing $@ would drop them.

  • $COUNT, $START and $VERSION are package variables in Catalyst, so the replacements reach them by full name.

  • Try::Tiny runs its body in a subroutine and this runs it in a block. No body here contains return, next or wantarray, so the two are equivalent, and the context object still falls out of scope at the same point.

AUTHOR

LNATION <email@lnation.org>

LICENSE AND COPYRIGHT

This software is Copyright (c) 2026 by LNATION <email@lnation.org>.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)