[Koha-bugs] [Bug 27557] Add the ability to display the error that caused a 500

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Wed Mar 17 01:21:00 CET 2021


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

--- Comment #4 from David Cook <dcook at prosentient.com.au> ---
(In reply to Jonathan Druart from comment #3)
> Any ideas how we could retrieve the original error (vs the whole stacktrace)?

Based on my comment from
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26048#c29, I think we
would need to replace Plack::Middleware::HTTPException with our own custom
error handling middleware. 

Looking at the patch here, I would remind folk that the StackTrace middleware
is only recommended for development and not production: "You're recommended to
use this middleware during the development and use
Plack::Middleware::HTTPExceptions in the deployment mode as a replacement"
(https://metacpan.org/pod/Plack::Middleware::StackTrace).

But the concept used by StackTrace (ie $env->{'plack.stacktrace.text'} =
$text;) is what I would suggest.

Ultimately, write a middleware that catches the error using eval{} or
try/catch, save the error to an environmental variable, print the error to
psgi.errors, and then move on to the ErrorDocument middleware.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.


More information about the Koha-bugs mailing list