Name

Unexpected::TraitFor::ErrorLeader - Prepends a leader to the exception

Synopsis

   package MyException;

   use Moo;

   extends 'Unexpected';
   with    'Unexpected::TraitFor::ErrorLeader';

Description

Prepends a one line stack summary to the exception error message

Configuration and Environment

Requires the as_string method in the consuming class, the clone method from the Throwing role, as well as frames from the stack trace role

Defines the following attributes;

leader

Set to the package and line number where the error should be reported

level

A positive integer which defaults to one. How many additional stack frames to pop before calculating the leader attribute

Modifies as_string in the consuming class. Prepends the leader attribute to the return value

Subroutines/Methods

ignore

   $array_ref = $self->ignore;

Read only accessor for the $Ignore package scoped variable. Defaults to an empty array ref

ignore_class

   Unexpected->ignore_class( $classname );

The $Ignore package scoped variable is an array ref of methods whose presence should be ignored by the error message leader. This method pushes $classname onto that array ref

Diagnostics

None

Dependencies

namespace::autoclean
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

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