NAME

Venus::Role::Throwable - Throwable Role

ABSTRACT

Throwable Role for Perl 5

SYNOPSIS

package Example;

use Venus::Class;

with 'Venus::Role::Throwable';

package main;

my $example = Example->new;

# $example->throw;

DESCRIPTION

This package modifies the consuming package and provides a mechanism for throwing context-aware errors (exceptions).

METHODS

This package provides the following methods:

throw

throw(Maybe[Str] $package) (Throw)

The throw method builds a Venus::Throw object, which can raise errors (exceptions).

Since 0.01

throw example 1
package main;

my $example = Example->new;

my $throw = $example->throw;

# bless({ "package" => "Example::Error", ..., }, "Venus::Throw")

# $throw->error;