.\" Automatically generated by Pod::Man 4.14 (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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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 "Dancer::Error 3pm" .TH Dancer::Error 3pm "2023-02-10" "perl v5.36.0" "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" Dancer::Error \- class for representing fatal errors .SH "VERSION" .IX Header "VERSION" version 1.3521 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& # taken from send_file: \& use Dancer::Error; \& \& my $error = Dancer::Error\->new( \& code => 404, \& message => "No such file: \`$path\*(Aq" \& ); \& \& $error\->render; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" With Dancer::Error you can throw reasonable-looking errors to the user instead of crashing the application and filling up the logs. .PP This is usually used in debugging environments, and it's what Dancer uses as well under debugging to catch errors and show them on screen. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .SS "code" .IX Subsection "code" The code that caused the error. .PP This is only an attribute getter, you'll have to set it at \f(CW\*(C`new\*(C'\fR. .SS "title" .IX Subsection "title" The title of the error page. .PP This is only an attribute getter, you'll have to set it at \f(CW\*(C`new\*(C'\fR. .SS "message" .IX Subsection "message" The message of the error page. .PP This is only an attribute getter, you'll have to set it at \f(CW\*(C`new\*(C'\fR. .SS "exception" .IX Subsection "exception" The exception that caused the error. If the error was not caused by an exception, returns undef. Exceptions are usually objects that inherit from Dancer::Exception. .PP This is only an attribute getter, you'll have to set it at \f(CW\*(C`new\*(C'\fR. .SH "METHODS/SUBROUTINES" .IX Header "METHODS/SUBROUTINES" .SS "new" .IX Subsection "new" Create a new Dancer::Error object. .PP \fItitle\fR .IX Subsection "title" .PP The title of the error page. .PP \fItype\fR .IX Subsection "type" .PP What type of error this is. .PP \fIcode\fR .IX Subsection "code" .PP The code that caused the error. .PP \fImessage\fR .IX Subsection "message" .PP The message that will appear to the user. .PP \fIexception\fR .IX Subsection "exception" .PP The exception that will be useable by the rendering. .SS "backtrace" .IX Subsection "backtrace" Create a backtrace of the code where the error is caused. .PP This method tries to find out where the error appeared according to the actual error message (using the \f(CW\*(C`message\*(C'\fR attribute) and tries to parse it (supporting the regular/default Perl warning or error pattern and the Devel::SimpleTrace output) and then returns an error-highlighted \f(CW\*(C`message\*(C'\fR. .SS "tabulate" .IX Subsection "tabulate" Small subroutine to help output nicer. .SS "dumper" .IX Subsection "dumper" This uses Data::Dumper to create nice content output with a few predefined options. .SS "render" .IX Subsection "render" Renders a response using Dancer::Response. .SS "environment" .IX Subsection "environment" A main function to render environment information: the caller (using \&\f(CW\*(C`get_caller\*(C'\fR), the settings and environment (using \f(CW\*(C`dumper\*(C'\fR) and more. .SS "get_caller" .IX Subsection "get_caller" Creates a stack trace of callers. .SS "_censor" .IX Subsection "_censor" An internal method that tries to censor out content which should be protected. .PP \&\f(CW\*(C`dumper\*(C'\fR calls this method to censor things like passwords and such. .SS "_html_encode" .IX Subsection "_html_encode" Internal method to encode entities that are illegal in (X)HTML. We output as \&\s-1UTF\-8,\s0 so no need to encode all non-ASCII characters or use a module. \&\s-1FIXME :\s0 this is not true any more, output can be any charset. Need fixing. .SH "AUTHOR" .IX Header "AUTHOR" Dancer Core Developers .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2010 by Alexis Sukrieh. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.