NAME

Throwable::Error - an easy-to-use class for error objects

VERSION

version 0.091900

SYNOPSIS

package MyApp::Error;
use Moose;
extends 'Throwable::Error';

has execution_phase => (is => 'ro', isa => 'MyApp::Phase');

...and in your app...

MyApp::Error->throw({ phase => $self->phase });

DESCRIPTION

Throwable::Error is a base class for exceptions that will be thrown to signal errors and abort normal program flow. Throwable::Error is an alternative to Exception::Class, the features of which are largely provided by the Moose object system atop which Throwable::Error is built.

Throwable::Error performs the Throwable role.

ATTRIBUTES

message

This attribute must be defined and must contain a string describing the error condition. This string will be printed at the top of the stack trace when the error is stringified.

stack_trace

This attribute will contain an object representing the stack at the point when the error was generated and thrown. It must be an object performing the as_string method.

stack_trace_class

This attribute may be provided to use an alternate class for stack traces. The default is Devel::StackTrace.

In general, you will not need to think about this attribute.

stack_trace_args

This attribute is an arrayref of arguments to pass when building the stack trace. In general, you will not need to think about it.

METHODS

as_string

This method will provide a string representing the error, containing the error's message followed by the its stack trace.

AUTHORS

Ricardo SIGNES <rjbs@cpan.org>
Florian Ragwitz <rafl@debian.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2009 by Ricardo SIGNES.

This is free software; you can redistribute it and/or modify it under the same terms as perl itself.