.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Plack::Middleware::StackTrace 3pm" .TH Plack::Middleware::StackTrace 3pm 2024-01-20 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Plack::Middleware::StackTrace \- Displays stack trace when your app dies .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& enable "StackTrace"; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This middleware uses \f(CW$SIG{_\|_DIE_\|_}\fR to intercept \fIall\fR exceptions (run-time errors) happening in your application, even those that are caught. For each exception it builds a detailed stack trace. .PP If the applications aborts by throwing an exception it will be caught and matched against the saved stack traces. If a match is found it will be displayed as a nice stack trace screen, if not then the exception will be reported without a stack trace. .PP The stack trace is also stored in the environment as a plaintext and HTML under the key \&\f(CW\*(C`plack.stacktrace.text\*(C'\fR and \f(CW\*(C`plack.stacktrace.html\*(C'\fR respectively, so that middleware further up the stack can reference it. .PP This middleware is enabled by default when you run plackup in the default \fIdevelopment\fR mode. .PP You're recommended to use this middleware during the development and use Plack::Middleware::HTTPExceptions in the deployment mode as a replacement, so that all the exceptions thrown from your application still get caught and rendered as a 500 error response, rather than crashing the web server. .PP Catching errors in streaming response is not supported. .SS "Stack Trace Module" .IX Subsection "Stack Trace Module" The Devel::StackTrace::WithLexicals module will be used to capture the stack trace if the installed version is 0.08 or later. Otherwise Devel::StackTrace is used. .SS Performance .IX Subsection "Performance" Gathering the information for a stack trace via Devel::StackTrace is slow, and Devel::StackTrace::WithLexicals is significantly slower still. This is not usually a concern in development and when exceptions are rare. However, your application may include code that's throwing and catching exceptions that you're not aware of. Such code will run \fIsignificantly\fR slower with this module. .SH CONFIGURATION .IX Header "CONFIGURATION" .IP force 4 .IX Item "force" .Vb 1 \& enable "StackTrace", force => 1; .Ve .Sp Force display the stack trace when an error occurs within your application and the response code from your application is 500. Defaults to off. .Sp The use case of this option is that when your framework catches all the exceptions in the main handler and returns all failures in your code as a normal 500 PSGI error response. In such cases, this middleware would never have a chance to display errors because it can't tell if it's an application error or just random \f(CW\*(C`eval\*(C'\fR in your code. This option enforces the middleware to display stack trace even if it's not the direct error thrown by the application. .IP no_print_errors 4 .IX Item "no_print_errors" .Vb 1 \& enable "StackTrace", no_print_errors => 1; .Ve .Sp Skips printing the text stacktrace to console (\f(CW\*(C`psgi.errors\*(C'\fR). Defaults to 0, which means the text version of the stack trace error is printed to the errors handle, which usually is a standard error. .SH AUTHOR .IX Header "AUTHOR" Tokuhiro Matsuno .PP Tatsuhiko Miyagawa .SH "SEE ALSO" .IX Header "SEE ALSO" Devel::StackTrace::AsHTML Plack::Middleware Plack::Middleware::HTTPExceptions