-
-
31 Jul 2017 21:47:25 UTC
- Distribution: Unexpected
- Module version: v1.0.1
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (1)
- Testers (788 / 0 / 0)
- Kwalitee
Bus factor: 0- 99.47% Coverage
- License: perl_5
- Perl: v5.10.1
- Activity
24 month- Tools
- Download (35.2KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Devel::StackTrace
- Exporter::Tiny
- Module::Runtime
- Moo
- Package::Stash
- Sub::Install
- Type::Tiny
- namespace::autoclean
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- Name
- Synopsis
- Description
- Configuration and Environment
- Subroutines/Methods
- Diagnostics
- Dependencies
- Incompatibilities
- Bugs and Limitations
- Acknowledgements
- Author
- License and Copyright
Name
Unexpected::TraitFor::Throwing - Detects and throws exceptions
Synopsis
use Moo; with 'Unexpected::TraitFor::Throwing';
Description
Detects and throws exceptions
Configuration and Environment
Modifies
BUILD
in the consuming class. Caches the new exception for use by theprevious_exception
attribute in the next exception thrownRequires the consuming class to have the class method
is_one_of_us
Defines the following list of attributes;
previous_exception
-
May hold a reference to the previous exception in this thread
Subroutines/Methods
BUILD
After construction the current exception is cached so that it can become the previous exception the next time an exception is thrown
caught
$exception_object_ref = Unexpected->caught( @optional_args );
Catches and returns a thrown exception or generates a new exception if
$EVAL_ERROR
has been set. Returns either an exception object or undefinedclone
$cloned_exception_object_ref = $exception_object_ref->clone( $args );
Returns a clone of the invocant. The optional
$args
hash reference mutates the returned clonethrow
Unexpected->throw 'Path [_1] not found', args => [ 'pathname' ];
Create (or re-throw) an exception. If the passed parameter is a blessed reference it is re-thrown. If a single scalar is passed it is taken to be an error message, a new exception is created with all other parameters taking their default values. If more than one parameter is passed the it is treated as a list and used to instantiate the new exception. The 'error' parameter must be provided in this case
throw_on_error
Unexpected->throw_on_error( @optional_args );
Calls "caught" passing in the options
@args
and if there was an exception "throw"s it otherwise returns undefinedDiagnostics
None
Dependencies
Incompatibilities
There are no known incompatibilities in this module
Bugs and Limitations
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Acknowledgements
Larry Wall - For the Perl programming language
Author
Peter Flanigan,
<pjfl@cpan.org>
License and Copyright
Copyright (c) 2017 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
Module Install Instructions
To install Unexpected, copy and paste the appropriate command in to your terminal.
cpanm Unexpected
perl -MCPAN -e shell install Unexpected
For more information on module installation, please visit the detailed CPAN module installation guide.