Error::Hierarchy::Internal - Base class for internal exceptions


Error-Hierarchy documentation Contained in the Error-Hierarchy distribution.

Index


Code Index:

NAME

Top

Error::Hierarchy::Internal - Base class for internal exceptions

VERSION

Top

version 1.103530

DESCRIPTION

Top

This class implements the base class for internal exceptions. All internal exceptions should subclass it. However, you probably shouldn't throw an exception of this class; rather use Error::Hierarchy::Internal::CustomMessage.

This class is important so applications can define their own internal exceptions (opposed to business exceptions) and just catch objects of this class where appropriate.

METHODS

Top

is_optional

Returns 0, so this exception is not optional.

stringify

Defines how an exception should look like if it is used in a string: The same as Error::Hierarchy, but it prepends the package, filename and line the exception occurred in to the given message.

PROPERTIES

Top

This exception class inherits all properties of Error::Hierarchy.

It has no additional properties.

INSTALLATION

Top

See perlmodinstall for information and options on installing Perl modules.

BUGS AND LIMITATIONS

Top

No bugs have been reported.

Please report any bugs or feature requests through the web interface at http://rt.cpan.org/Public/Dist/Display.html?Name=Error-Hierarchy.

AVAILABILITY

Top

The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see http://search.cpan.org/dist/Error-Hierarchy/.

The development version lives at http://github.com/hanekomu/Error-Hierarchy and may be cloned from git://github.com/hanekomu/Error-Hierarchy. Instead of sending patches, please fork this project using the standard git and github infrastructure.

AUTHOR

Top

Marcel Gruenauer <marcel@cpan.org>

COPYRIGHT AND LICENSE

Top


Error-Hierarchy documentation Contained in the Error-Hierarchy distribution.

use 5.008;
use strict;
use warnings;

package Error::Hierarchy::Internal;
BEGIN {
  $Error::Hierarchy::Internal::VERSION = '1.103530';
}
# ABSTRACT: Base class for internal exceptions

use parent 'Error::Hierarchy';
use constant PROPERTIES => (qw/package filename line/);
sub is_optional { 0 }

sub stringify {
    my $self = shift;
    my $message =
      "Exception: package [%s], filename [%s], line [%s]: " . $self->message;
    sprintf $message => map { defined($self->$_) ? $self->$_ : 'unknown' }
      $self->get_properties;
}
1;


__END__