https://github.com/awncorp/data-object-exception
Exception Class for Perl 5
https://github.com/awncorp/data-object-exception
object-oriented perl perl5
Last synced: 8 months ago
JSON representation
Exception Class for Perl 5
- Host: GitHub
- URL: https://github.com/awncorp/data-object-exception
- Owner: awncorp
- License: other
- Created: 2020-10-03T19:04:47.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-03T20:34:01.000Z (over 5 years ago)
- Last Synced: 2025-01-01T11:27:39.277Z (over 1 year ago)
- Topics: object-oriented, perl, perl5
- Language: Perl
- Size: 29.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: CHANGES
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
NAME
Data::Object::Exception
ABSTRACT
Exception Class for Perl 5
SYNOPSIS
use Data::Object::Exception;
my $exception = Data::Object::Exception->new;
# $exception->throw
DESCRIPTION
This package provides functionality for creating, throwing, and
introspecting exception objects.
SCENARIOS
This package supports the following scenarios:
args-1
use Data::Object::Exception;
my $exception = Data::Object::Exception->new('Oops!');
# $exception->throw
The package allows objects to be instantiated with a single argument.
args-kv
use Data::Object::Exception;
my $exception = Data::Object::Exception->new(message => 'Oops!');
# $exception->throw
The package allows objects to be instantiated with key-value arguments.
ATTRIBUTES
This package has the following attributes:
context
context(Any)
This attribute is read-only, accepts (Any) values, and is optional.
id
id(Str)
This attribute is read-only, accepts (Str) values, and is optional.
message
message(Str)
This attribute is read-only, accepts (Str) values, and is optional.
METHODS
This package implements the following methods:
explain
explain() : Str
The explain method returns an error message with stack trace.
explain example #1
use Data::Object::Exception;
my $exception = Data::Object::Exception->new('Oops!');
$exception->explain
throw
throw(Tuple[Str, Str] | Str $message, Any $context, Maybe[Number] $offset) : Any
The throw method throws an error with message (and optionally, an ID).
throw example #1
use Data::Object::Exception;
my $exception = Data::Object::Exception->new;
$exception->throw('Oops!')
throw example #2
use Data::Object::Exception;
my $exception = Data::Object::Exception->new('Oops!');
$exception->throw
throw example #3
use Data::Object::Exception;
my $exception = Data::Object::Exception->new;
$exception->throw(['E001', 'Oops!'])
trace
trace(Int $offset, $Int $limit) : Object
The trace method compiles a stack trace and returns the object. By
default it skips the first frame.
trace example #1
use Data::Object::Exception;
my $exception = Data::Object::Exception->new('Oops!');
$exception->trace(0)
trace example #2
use Data::Object::Exception;
my $exception = Data::Object::Exception->new('Oops!');
$exception->trace(1)
trace example #3
use Data::Object::Exception;
my $exception = Data::Object::Exception->new('Oops!');
$exception->trace(0,1)
AUTHOR
Al Newkirk, awncorp@cpan.org
LICENSE
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under
the terms of the The Apache License, Version 2.0, as elucidated in the
"license file"
.
PROJECT
Wiki
Project
Initiatives
Milestones
Contributing
Issues