Name

CatalystX::Usul::Exception - Exception base class

Version

0.6.$Revision: 1165 $

Synopsis

use base qw(CatalystX::Usul);

use Try::Tiny;

sub some_method {
   my $self = shift;

   eval  { this_will_fail };
   $self->throw_on_error;

   OR

   try   { this_will_fail }
   catch { $self->throw( $_ ) };
}

Description

Implements try (by way of an eval), throw, and catch error semantics. Inherits from Exception::Class

Subroutines/Methods

new

Create an exception object. You probably do not want to call this directly, but indirectly through "catch" and "throw"

Calls the "full_message" method if asked to serialize

catch

Catches and returns a thrown exception or generates a new exception if EVAL_ERROR has been set. Returns either an exception object or undef

full_message

This is what the object stringifies to

stacktrace

$lines = $e->stacktrace( $num_lines_to_skip );

Return the stack trace. Defaults to skipping one (the first) line of output

throw

Create (or re-throw) an exception to be caught by the catch above. 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 code, 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

Calls "catch" and if the was an exception "throw"s it

Diagnostics

None

Configuration and Environment

The $IGNORE package variable is list of methods whose presence should be suppressed in the stack trace output

Dependencies

Exception::Class
MRO::Compat
Scalar::Util

Incompatibilities

There are no known incompatibilities in this module

Bugs and Limitations

The default ignore package list should be configurable

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Author

Peter Flanigan <Support at RoxSoft.co.uk>

License and Copyright

Copyright (c) 2008 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