Specio::Exception(3) User Contributed Perl Documentation Specio::Exception(3)

# [SYNOPSIS](#SYNOPSIS)

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

# [DESCRIPTION](#DESCRIPTION)

This exception class is thrown by Specio when a type check fails. It emulates the Throwable::Error API, but doesn't use that module to avoid adding a dependency on Moo.

# [API](#API)

This class provides the following methods:

## [$exception-&gt;message](#$exception)

The error message associated with the exception.

## [$exception-&gt;stack\_trace](#$exception~2)

A Devel::StackTrace object for the exception.

## [$exception-&gt;type](#$exception~3)

The type constraint object against which the value failed.

## [$exception-&gt;value](#$exception~4)

The value that failed the type check.

## [$exception-&gt;as\_string](#$exception~5)

The exception as a string. This includes the method and the stack trace.

# [OVERLOADING](#OVERLOADING)

This class overloads stringification to call the "as\_string" method.

2026-10-24 perl v5.44.0

---

Document: Specio::Exception(3pm) from perl-specio 0.53-r6 (Chainguard OS)
Source: https://github.com/houseabsolute/Specio
