NAME

Type::Exception - A Throwable::Error subclass for type constraint failures

VERSION

version 0.03

DESCRIPTION

This is a subclass of Throwable::Error which adds a few additional attributes specific to type constraint failures.

DESCRIPTION

use Try::Tiny;

try {
    $type->validate_or_die($value);
}
catch {
    if ( $_->isa('Type::Exception') ) {
        print $_->message(), "\n";
        print $_->type()->name(), "\n";
        print $_->value(), "\n";
    }
};

API

The two attributes it adds are type and value, both of which are required. The type must be a Type::Constraint::Role::Interface object, and the value can be anything (including undef).

AUTHOR

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2012 by Dave Rolsky.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)