Data::Object::Exception
Data-Object Exception Class
use Data::Object::Exception; my $exception = Data::Object::Exception->new; die $exception; $exception->throw('Oops'); die $exception->new('Oops')->trace(0); "$exception" # renders exception message
This package provides functionality for creating, throwing, and introspecting exception objects.
This package uses type constraints defined by:
Data::Object::Library
This package implements the following methods.
e() : Any
Render the exception message with optional context and stack trace.
my $e = $exception->explain();
new(HashRef $arg1) : ExceptionObject
The new method expects a message, or named arguments, and returns a new class instance.
# Oops my $exception = Data::Object::Exception->new( message => 'Oops' });
throw(Str $arg1) : Object
Throw error with message and context.
$exception->throw();
trace(Int $offset, $Int $limit) : ExceptionObject
The trace method compiles a stack trace and returns the object. By default it skips the first frame.
# $exception my $trace = $exception->trace; my $trace = $exception->trace(0); # all frames my $trace = $exception->trace(0, 5); # five frames, no skip
Al Newkirk, +296
+296
Anthony Brummett, +10
+10
José Joaquín Atria, +1
+1
Al Newkirk, awncorp@cpan.org
awncorp@cpan.org
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
GitHub
Projects
Milestones
Contributing
Issues
To get the most out of this distribution, consider reading the following:
Do
Data::Object
Data::Object::Class
Data::Object::ClassHas
Data::Object::Role
Data::Object::RoleHas
To install Do, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Do
CPAN shell
perl -MCPAN -e shell install Do
For more information on module installation, please visit the detailed CPAN module installation guide.