1Dancer::Error(3)      User Contributed Perl Documentation     Dancer::Error(3)
2
3
4

NAME

6       Dancer::Error - class for representing fatal errors
7

VERSION

9       version 1.3513
10

SYNOPSIS

12           # taken from send_file:
13           use Dancer::Error;
14
15           my $error = Dancer::Error->new(
16               code    => 404,
17               message => "No such file: `$path'"
18           );
19
20           $error->render;
21

DESCRIPTION

23       With Dancer::Error you can throw reasonable-looking errors to the user
24       instead of crashing the application and filling up the logs.
25
26       This is usually used in debugging environments, and it's what Dancer
27       uses as well under debugging to catch errors and show them on screen.
28

ATTRIBUTES

30   code
31       The code that caused the error.
32
33       This is only an attribute getter, you'll have to set it at "new".
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   message
41       The message of the error page.
42
43       This is only an attribute getter, you'll have to set it at "new".
44
45   exception
46       The exception that caused the error. If the error was not caused by an
47       exception, returns undef. Exceptions are usually objects that inherit
48       from Dancer::Exception.
49
50       This is only an attribute getter, you'll have to set it at "new".
51

METHODS/SUBROUTINES

53   new
54       Create a new Dancer::Error object.
55
56       title
57
58       The title of the error page.
59
60       type
61
62       What type of error this is.
63
64       code
65
66       The code that caused the error.
67
68       message
69
70       The message that will appear to the user.
71
72       exception
73
74       The exception that will be useable by the rendering.
75
76   backtrace
77       Create a backtrace of the code where the error is caused.
78
79       This method tries to find out where the error appeared according to the
80       actual error message (using the "message" attribute) and tries to parse
81       it (supporting the regular/default Perl warning or error pattern and
82       the Devel::SimpleTrace output) and then returns an error-highlighted
83       "message".
84
85   tabulate
86       Small subroutine to help output nicer.
87
88   dumper
89       This uses Data::Dumper to create nice content output with a few
90       predefined options.
91
92   render
93       Renders a response using Dancer::Response.
94
95   environment
96       A main function to render environment information: the caller (using
97       "get_caller"), the settings and environment (using "dumper") and more.
98
99   get_caller
100       Creates a stack trace of callers.
101
102   _censor
103       An internal method that tries to censor out content which should be
104       protected.
105
106       "dumper" calls this method to censor things like passwords and such.
107
108   _html_encode
109       Internal method to encode entities that are illegal in (X)HTML. We
110       output as UTF-8, so no need to encode all non-ASCII characters or use a
111       module.  FIXME : this is not true any more, output can be any charset.
112       Need fixing.
113

AUTHOR

115       Dancer Core Developers
116
118       This software is copyright (c) 2010 by Alexis Sukrieh.
119
120       This is free software; you can redistribute it and/or modify it under
121       the same terms as the Perl 5 programming language system itself.
122
123
124
125perl v5.32.0                      2020-07-28                  Dancer::Error(3)
Impressum