1Dancer2::Core::Error(3)User Contributed Perl DocumentatioDnancer2::Core::Error(3)
2
3
4
6 Dancer2::Core::Error - Class representing fatal errors
7
9 version 0.301004
10
12 # taken from send_file:
13 use Dancer2::Core::Error;
14
15 my $error = Dancer2::Core::Error->new(
16 status => 404,
17 message => "No such file: `$path'"
18 );
19
20 Dancer2::Core::Response->set($error->render);
21
23 With Dancer2::Core::Error you can throw reasonable-looking errors to
24 the user instead of crashing the application and filling up the logs.
25
26 This is usually used in debugging environments, and it's what Dancer2
27 uses as well under debugging to catch errors and show them on screen.
28
30 show_errors
31 charset
32 type
33 The error type.
34
35 title
36 The title of the error page.
37
38 This is only an attribute getter, you'll have to set it at "new".
39
40 status
41 The status that caused the error.
42
43 This is only an attribute getter, you'll have to set it at "new".
44
45 message
46 The message of the error page.
47
49 my $error=new Dancer2::Core::Error(status => 404, message => "No such
50 file: `$path'");
51 Create a new Dancer2::Core::Error object. For available arguments see
52 ATTRIBUTES.
53
54 supported_hooks ();
55 throw($response)
56 Populates the content of the response with the error's information. If
57 $response is not given, acts on the app attribute's response.
58
59 backtrace
60 Show the surrounding lines of context at the line where the error was
61 thrown.
62
63 This method tries to find out where the error appeared according to the
64 actual error message (using the "message" attribute) and tries to parse
65 it (supporting the regular/default Perl warning or error pattern and
66 the Devel::SimpleTrace output) and then returns an error-highlighted
67 "message".
68
69 environment
70 A main function to render environment information: the caller (using
71 "get_caller"), the settings and environment (using "dumper") and more.
72
73 get_caller
74 Creates a stack trace of callers.
75
77 _censor
78 An private function that tries to censor out content which should be
79 protected.
80
81 "dumper" calls this method to censor things like passwords and such.
82
83 my $string=_html_encode ($string);
84 Private function that replaces illegal entities in (X)HTML with their
85 escaped representations.
86
87 html_encode() doesn't do any UTF black magic.
88
89 dumper
90 This uses Data::Dumper to create nice content output with a few
91 predefined options.
92
94 Dancer Core Developers
95
97 This software is copyright (c) 2021 by Alexis Sukrieh.
98
99 This is free software; you can redistribute it and/or modify it under
100 the same terms as the Perl 5 programming language system itself.
101
102
103
104perl v5.34.0 2022-01-21 Dancer2::Core::Error(3)