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

version 0.04

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

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

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).

Dave Rolsky <autarch@urth.org>

This software is Copyright (c) 2012 by Dave Rolsky.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)