For my Catalyst
project I am using an own Moose
based exception type, that is compatible with Catalyst
and my command line applications.
To provide clients of my Catalyst REST interface with error messages, I implemented a code
subroutine that is providing http status codes as part of my exception class. This way, I want to use Plack::Middleware
as described in the pod documentation of Plack::Middleware::HTTPExceptions
.
Everything works fine. The exceptions are returned to the client the way I want to them to be returned.
My problem is: whenever I throw an exception, that is caught by the middle ware, my logging (Log::Log4perl
) is lost and I can find neither traces nor errors in Catalyst
's web server perl script output.
Whenever I throw errors, that are not encapsulated by my exception class, but rare string (like die "BOOM!"
), the log output is written and the error is documented (obviously, the error is caught by Catalyst
and is not re-thrown).
How can I tell Catalyst
to keep logging requests, even though the exception has to be re-thrown to the middle ware?