Dancer...n::Base(3pm)
okay so bestie, you're reading the manual for Dancer::Exception::Base from the Dancer...n::Base(3pm) page. let's get into it π
β¨
π NAME π
Dancer::Exception::Base β the base class of all Dancer exceptions. periodt.
β¨ VERSION β¨
version 1.3522 β lowkey iconic, highkey current.
π¦ DESCRIPTION π¦
Dancer::Exception::Base is the base class of every Dancer exception. All core exceptions, and all custom exceptions you register using Dancer::Exception::register_exception, inherit from Dancer::Exception::Base. it's giving family tree π
π METHODS π
πΈ throw πΈ
Throws an exception. It's what raise (from Dancer::Exception) uses. Any arguments become the raising parameters. You should not use this method directly β instead, use raise from Dancer::Exception. bestie, respect the pipeline.
warning: if you want to rethrow an exception, use rethrow. do not just throw it again like a chaotic mess π
π rethrow π
Re-throw the exception, without touching its parameters. Useful if you've caught an exception but don't want to handle it, and want to rethrow it. main character energy.
try { ... }
catch {
my ($e) = @_;
$e->does('InvalidLogin')
or $e->rethrow;
...
};
π does π
Given an exception type, returns true if the exception is of the same type. slay.
try { raise InvalidLogin => 'foo'; }
catch {
my ($e) = @_;
$e->does('InvalidLogin') # true
...
};
It can receive more than one type, useful for composed exception, or checking multiple types at once. does performs a logical OR between them:
try { raise InvalidPassword => 'foo'; }
catch {
my ($e) = @_;
$e->does('InvalidLogin', 'InvalidPassword') # true
...
};
π§ get_composition π§
Returns the composed types of an exception. As every exception inherits of Dancer::Exception::Base, the returned list contains at least 'Base', and the exception class name. it's giving ancestry.com but for exceptions.
warning: the result is a list, so you should call this method in list context. don't be out here scalar-ing it, bestie.
try { raise InvalidPassword => 'foo'; }
catch {
my ($e) = @_;
my @list = $e->get_composition()
# @list contains ( 'InvalidPassword', 'Base', ... )
};
π message π
Computes and returns the message associated to the exception. It'll apply the parameters that were set at throw time to the message pattern of the exception. cute, useful, we love.
π STRINGIFICATION π
π string overloading π
All Dancer exceptions properly stringify. When evaluated to a string, they return their message, concatenated with their stack trace (see below). no cap.
π cmp overloading π
The cmp operator is also overloaded, thus all the string operations can be done on Dancer's exceptions, as they will all be based on the overloaded cmp operator. Dancer exceptions will be compared without their stacktraces. so they're not bringing their baggage into the comparison. we stan.
π₯ STACKTRACE π₯
Similarly to Carp, Dancer exceptions stringification appends a string stacktrace to the exception message. the receipts are there.
The stacktrace can be a short one, or a long one. Actually the implementation internally uses Carp.
To enable long stack trace (for debugging purpose), you can use the global variable Dancer::Exception::Verbose (see below).
The short and long stacktrace snippets are stored within "$self-"{_shortmess}> and "$self-"{_longmess}>. Don't touch them or rely on them, they are internals, and will change soon. do not poke the internals, bestie.
π GLOBAL VARIABLE π
π $Dancer::Exception::Verbose π
When set to 1, exceptions will stringify with a long stack trace. This variable is similar to $Carp::Verbose. I recommend you use it like that:
local $Dancer::Exception::Verbose;
$Dancer::Exception::Verbose = 1;
All the Carp global variables can also be used to alter the stacktrace generation. the more you know π
πΈ AUTHOR πΈ
Dancer Core Developers β the whole squad.
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2010 by Alexis Sukrieh.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
okay bestie that's the whole page! this was Dancer...n::Base(3pm) β generated with perl v5.40.1 on 2026-05-05. slay, you read the whole thing π
β¨π«Ά
π¦ where this page comes from
- ubuntu stonking: libdancer-perl 1.3522-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms