Specio::Exception(3)

πŸ’– NAME πŸ’–

This is the Specio::Exception(3) manual page, bestie β€” a User Contributed Perl Documentation moment β€” and the name is Specio::Exception, aka An exception class for type constraint failures. That's the whole name vibe: type constraint failure, exception class, slay. πŸ’…

🌈 VERSION 🌈

version 0.49 β€” yes, that's the version, no cap. ✨

πŸ¦‹ SYNOPSIS πŸ¦‹

Here's the try/catch situation, bestie:

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 🌸

So this exception class is thrown by Specio when a type check fails. It emulates the Throwable::Error API, but it doesn't use that module β€” the whole reason is to avoid adding a dependency on Moo. Lowkey iconic engineering choice, fr fr. πŸ”₯

🧚 API 🧚

This class provides the following methods β€” collect them like little method PokΓ©mon:

πŸ’– $exception->message πŸ’–

The error message associated with the exception. That's the message, bestie. πŸ’Œ

πŸ’– $exception->stack_trace πŸ’–

A Devel::StackTrace object for the exception. It's giving stack trace realness. 🫢

πŸ’– $exception->type πŸ’–

The type constraint object against which the value failed. Yep, the actual type object that said "not today." πŸ‘‘

πŸ’– $exception->value πŸ’–

The value that failed the type check. The audacity of this value, honestly. 😭

πŸ’– $exception->as_string πŸ’–

The exception as a string. This includes the method and the stack trace. So it's not just a vibe β€” it's a string with the method and the stack trace in it. ✨

πŸ’… OVERLOADING πŸ’…

This class overloads stringification to call the as_string method. So when you stringify one of these exceptions, it calls as_string. That's the whole overloading tea. 🍡

πŸ› SUPPORT πŸ›

Bugs may be submitted at https://github.com/houseabsolute/Specio/issues. Not the cute kind of bugs, bestie β€” the GitHub issue kind. πŸ™ˆ

πŸ“š SOURCE πŸ“š

The source code repository for Specio can be found at https://github.com/houseabsolute/Specio. Go look, it's giving open source excellence. 🌈

πŸ‘‘ AUTHOR πŸ‘‘

Dave Rolsky <autarch@urth.org>. Iconic author behavior. πŸ’œ

This software is Copyright (c) 2012 - 2024 by Dave Rolsky.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

The full text of the license can be found in the LICENSE file included with this distribution. Read the license, bestie β€” it's important. 🫢


That's the whole Specio::Exception(3) manual page, from perl v5.42.0, dated 2024-12-24. Now go validate something and slay πŸ’…βœ¨

πŸ“¦ where this page comes from