.\" 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 "Dancer2::Core::Error 3pm" .TH Dancer2::Core::Error 3pm "2023-12-15" "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" Dancer2::Core::Error \- Class representing fatal errors .SH "VERSION" .IX Header "VERSION" version 1.1.0 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Dancer2::Core::Error; \& \& my $error = Dancer2::Core::Error\->new( \& status => 404, \& message => "No such file: \`$path\*(Aq" \& ); \& \& $error\->throw; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" With Dancer2::Core::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 Dancer2 uses as well under debugging to catch errors and show them on screen. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" .SS "show_stacktrace" .IX Subsection "show_stacktrace" .SS "charset" .IX Subsection "charset" .SS "type" .IX Subsection "type" The error type. .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 "status" .IX Subsection "status" The status 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 "message" .IX Subsection "message" The message of the error page. .SH "METHODS" .IX Header "METHODS" .ie n .SS "my $error=new Dancer2::Core::Error(status => 404, message => ""No such file: `$path'"");" .el .SS "my \f(CW$error\fP=new Dancer2::Core::Error(status => 404, message => ``No such file: `$path''');" .IX Subsection "my $error=new Dancer2::Core::Error(status => 404, message => No such file: `$path');" Create a new Dancer2::Core::Error object. For available arguments see \s-1ATTRIBUTES.\s0 .SS "supported_hooks ();" .IX Subsection "supported_hooks ();" .SS "throw($response)" .IX Subsection "throw($response)" Populates the content of the response with the error's information. If \fI\f(CI$response\fI\fR is not given, acts on the \fIapp\fR attribute's response. .SS "backtrace" .IX Subsection "backtrace" Show the surrounding lines of context at the line where the error was thrown. .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 "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. .SH "FUNCTIONS" .IX Header "FUNCTIONS" .SS "_censor" .IX Subsection "_censor" An private function 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. .ie n .SS "my $string=_html_encode ($string);" .el .SS "my \f(CW$string\fP=_html_encode ($string);" .IX Subsection "my $string=_html_encode ($string);" Private function that replaces illegal entities in (X)HTML with their escaped representations. .PP \&\fBhtml_encode()\fR doesn't do any \s-1UTF\s0 black magic. .SS "dumper" .IX Subsection "dumper" This uses Data::Dumper to create nice content output with a few predefined options. .SH "AUTHOR" .IX Header "AUTHOR" Dancer Core Developers .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2023 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.