Throwable::Error(3) User Contributed Perl Documentation Throwable::Error(3)

# [SYNOPSIS](#SYNOPSIS)

```
  package MyApp::Error;
  # NOTE: Moo can also be used here instead of Moose
  use Moose;
  extends 'Throwable::Error';
  has execution_phase => (
    is  => 'ro',
    isa => 'MyApp::Phase',
    default => 'startup',
  );
```

...and in your app...

```
  MyApp::Error->throw("all communications offline");
  # or...
  MyApp::Error->throw({
    message         => "all communications offline",
    execution_phase => 'shutdown',
  });
```

# [DESCRIPTION](#DESCRIPTION)

Throwable::Error is a base class for exceptions that will be thrown to signal errors and abort normal program flow. Throwable::Error is an alternative to Exception::Class, the features of which are largely provided by the Moo object system atop which Throwable::Error is built.

Throwable::Error performs the Throwable and StackTrace::Auto roles. That means you can call "throw" on it to create and throw an error object in one call, and that every error object will have a stack trace for its creation.

This attribute must be defined and must contain a string describing the error condition. This string will be printed at the top of the stack trace when the error is stringified.

This attribute, provided by StackTrace::Auto, will contain a stack trace object guaranteed to respond to the "as\_string" method. For more information about the stack trace and associated behavior, consult the StackTrace::Auto docs.

This method will provide a string representing the error, containing the error's message followed by the its stack trace.

# [POD ERRORS](#POD_ERRORS)

Hey! **The above document had some coding errors, which are explained below:**

[Around line 49:](#Around)

Unknown directive: =attr

[Around line 66:](#Around~2)

Unknown directive: =attr

[Around line 73:](#Around~3)

Unknown directive: =method

2026-10-26 perl v5.44.0

---

Document: Throwable::Error(3pm) from perl-throwable 1.001-r4 (Chainguard OS)
Source: https://github.com/rjbs/Throwable
