The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

Unexpected::TraitFor::StringifyingError - Base role for exception handling

Version

This documents version v0.19.$Rev: 1 $ of Unexpected::TraitFor::StringifyingError

Synopsis

   use Moo;

   with 'Unexpected::TraitFor::StringifyingError';

Description

Base role for exception handling

Configuration and Environment

Defines the following list of read only attributes;

args

An array ref of parameters substituted in for the placeholders in the error message when the error is localised

error

The actual error message which defaults to Unknown error. Can contain placeholders of the form [_<n>] where <n> is an integer starting at one. If passed a code ref it will be called passing in the calling classname and constructor hash ref, the return value will be used as the error string

Subroutines/Methods

as_string

   $error_text = $self->as_string;

This is what the object stringifies to

message

   $error_text_and_stack_trace = $self->message;

Returns the stringified object and a full stack trace

__build_attr_from

   $hash_ref = __build_attr_from( @args );

Function that coerces a hash ref from whatever is passed to it

Diagnostics

None

Dependencies

namespace::sweep
Moo::Role
Unexpected::Types

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

Author

Peter Flanigan <pjfl@cpan.org>

License and Copyright

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