The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

VERSION

version 0.06

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('Specio::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 Specio::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) 2013 by Dave Rolsky.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)