| 1 | package Valiant::Util::Exception::UnexpectedUseModuleError; | ||
| 2 | |||
| 3 | use Moo; | ||
| 4 | extends 'Valiant::Util::Exception'; | ||
| 5 | |||
| 6 | has err => (is=>'ro', required=>1); | ||
| 7 | has package => (is=>'ro', required=>1); | ||
| 8 | |||
| 9 | sub _build_message { | ||
| 10 | my ($self) = @_; | ||
| 11 | return "Package '@{[ $self->package ]}' returned unexpected error: @{[ $self->err ]}."; | ||
| 12 | } | ||
| 13 | |||
| 14 | 1; | ||
| 15 | |||
| 16 | =head1 NAME | ||
| 17 | |||
| 18 | Valiant::Util::Exception::UnexpectedUseModuleError - Unexpected error while using a module dynamically | ||
| 19 | |||
| 20 | =head1 SYNOPSIS | ||
| 21 | |||
| 22 | throw_exception UnexpectedUseModuleError => (package => $package, err => $@); | ||
| 23 | |||
| 24 | =head1 DESCRIPTION | ||
| 25 | |||
| 26 | We tried to load a module dynamically and got an error we can't handle for you. | ||
| 27 | |||
| 28 | =head1 ATTRIBUTES | ||
| 29 | |||
| 30 | =head2 err | ||
| 31 | |||
| 32 | =head2 package | ||
| 33 | |||
| 34 | The string message of the returned error and the package that caused it when trying to use dynamically | ||
| 35 | |||
| 36 | =head2 message | ||
| 37 | |||
| 38 | The actual exception message | ||
| 39 | |||
| 40 | =head1 SEE ALSO | ||
| 41 | |||
| 42 | L<Valiant> | ||
| 43 | |||
| 44 | =head1 AUTHOR | ||
| 45 | |||
| 46 | See L<Valiant> | ||
| 47 | |||
| 48 | =head1 COPYRIGHT & LICENSE | ||
| 49 | |||
| 50 | See L<Valiant> | ||
| 51 | |||
| 52 | =cut |