Test::Able::FatalException - Fatal Exception Class


Test-Able documentation Contained in the Test-Able distribution.

Index


Code Index:

NAME

Top

Test::Able::FatalException - Fatal Exception Class

SYNOPSIS

Top

 Test::Able::FatalException->throw->( 'get me outta here - for real!' );

DESCRIPTION

Top

Test::Able has special exception handling for the test-related methods.

This exception class is a means for breaking out of Test::Able's exception smothering.

See on_method_exception in Test::Able::Role::Meta::Class and method_exceptions in Test::Able::Role::Meta::Class for details.

ATTRIBUTES

Top

message

The text of the exception.

METHODS

Top

BUILDARGS

Standard Moose BUILDARGS method to allow single parameter construction.

throw

Main method used to construct and throw an exception object.

AUTHOR

Top

Justin DeVuyst, justin@devuyst.com

COPYRIGHT AND LICENSE

Top


Test-Able documentation Contained in the Test-Able distribution.
package Test::Able::FatalException;

use Moose;
use overload
  '""' => sub { return shift->message; },
  fallback => 1;
use strict;
use warnings;

has 'message' => ( is => 'rw', isa => 'Str', default => '', );

sub BUILDARGS {
    my $class = shift;

    if ( @_ == 1 ) {
        return { message => $_[ 0 ], };
    }
    else {
        return { @_ };
    };
}

sub throw {
    my $class = shift;

    die $class->new( @_, );
}

1;