1Plack::Middleware::StacUksTerracCeo(n3t)ributed Perl DocPulmaecnkt:a:tMiiodndleware::StackTrace(3)
2
3
4
6 Plack::Middleware::StackTrace - Displays stack trace when your app dies
7
9 enable "StackTrace";
10
12 This middleware uses $SIG{__DIE__} to intercept all exceptions (run-
13 time errors) happening in your application, even those that are caught.
14 For each exception it builds a detailed stack trace.
15
16 If the applications aborts by throwing an exception it will be caught
17 and matched against the saved stack traces. If a match is found it will
18 be displayed as a nice stack trace screen, if not then the exception
19 will be reported without a stack trace.
20
21 The stack trace is also stored in the environment as a plaintext and
22 HTML under the key "plack.stacktrace.text" and "plack.stacktrace.html"
23 respectively, so that middleware further up the stack can reference it.
24
25 This middleware is enabled by default when you run plackup in the
26 default development mode.
27
28 You're recommended to use this middleware during the development and
29 use Plack::Middleware::HTTPExceptions in the deployment mode as a
30 replacement, so that all the exceptions thrown from your application
31 still get caught and rendered as a 500 error response, rather than
32 crashing the web server.
33
34 Catching errors in streaming response is not supported.
35
36 Stack Trace Module
37 The Devel::StackTrace::WithLexicals module will be used to capture the
38 stack trace if the installed version is 0.08 or later. Otherwise
39 Devel::StackTrace is used.
40
41 Performance
42 Gathering the information for a stack trace via Devel::StackTrace is
43 slow, and Devel::StackTrace::WithLexicals is significantly slower
44 still. This is not usually a concern in development and when
45 exceptions are rare. However, your application may include code that's
46 throwing and catching exceptions that you're not aware of. Such code
47 will run significantly slower with this module.
48
50 force
51 enable "StackTrace", force => 1;
52
53 Force display the stack trace when an error occurs within your
54 application and the response code from your application is 500.
55 Defaults to off.
56
57 The use case of this option is that when your framework catches all
58 the exceptions in the main handler and returns all failures in your
59 code as a normal 500 PSGI error response. In such cases, this
60 middleware would never have a chance to display errors because it
61 can't tell if it's an application error or just random "eval" in
62 your code. This option enforces the middleware to display stack
63 trace even if it's not the direct error thrown by the application.
64
65 no_print_errors
66 enable "StackTrace", no_print_errors => 1;
67
68 Skips printing the text stacktrace to console ("psgi.errors").
69 Defaults to 0, which means the text version of the stack trace
70 error is printed to the errors handle, which usually is a standard
71 error.
72
74 Tokuhiro Matsuno
75
76 Tatsuhiko Miyagawa
77
79 Devel::StackTrace::AsHTML Plack::Middleware
80 Plack::Middleware::HTTPExceptions
81
82
83
84perl v5.32.0 2020-12-02 Plack::Middleware::StackTrace(3)