Error::...sertion(3)

πŸ’– Error::TypeTiny::Assertion β€” the manual, but make it make sense πŸ’–

okay bestie, so this page is from the User Contributed Perl Documentation section of the manual (that's the (3) vibe), and it's all about Error::TypeTiny::Assertion πŸ¦‹

✨ NAME ✨

Error::TypeTiny::Assertion β€” the exception that gets thrown when a value fails a type constraint. literally the moment your value does NOT pass the vibe check. πŸ’…


🌸 STATUS 🌸

This module is covered by the Type-Tiny stability policy. so it's official, it's sanctioned, it's got paperwork. πŸ‘‘


πŸŽ€ DESCRIPTION πŸŽ€

So. This exception gets thrown when a value fails a type constraint assertion. That's the whole thing. Your value walked up to the type constraint and the type constraint said "no πŸ’€".

This package inherits from Error::TypeTiny β€” so go read that one for most of the documentation, it's giving main character. The major differences are listed right down below:

🌈 Attributes 🌈

  • type β€” the type constraint that was checked against. heads up though: weakened links are involved, so this may end up being undef. 😭
  • value β€” the value that was tested. the little guy. the one that failed. πŸ₯Ί
  • varname β€” the name of the variable that was checked, if known. defaults to '$_'. ✨
  • attribute_name β€” if this exception was thrown as the result of an isa check or a failed coercion for a Moo attribute, then this will tell you which attribute (if your Moo is new enough). πŸ„

(Hopefully one day this will support other OO frameworks.)

  • attribute_step β€” if this exception was thrown as the result of an isa check or a failed coercion for a Moo attribute, then this will contain either "isa check" or "coercion" to indicate which one went wrong (if your Moo is new enough). πŸ”₯

(Hopefully one day this will support other OO frameworks.)

πŸ¦‹ Methods πŸ¦‹

  • has_type, has_attribute_name, has_attribute_step β€” predicate methods. yes bestie, they check whether the thing exists. that's it, that's the method. βœ…
  • message β€” overridden to add varname to the message if defined. so your error message gets a little name tag. 🏷️
  • explain β€” attempts to explain why the value did not pass the type constraint. returns an arrayref of strings providing step-by-step reasoning; or returns undef if no explanation is possible. it's basically the "so here's what happened" of error messages πŸ•΅οΈβ™€οΈ

πŸ’€ BUGS πŸ’€

Please report any bugs to <https://github.com/tobyink/p5-type-tiny/issues>.

ngl if you found a bug, drop it in the issue tracker, the maintainer wants to know fr fr πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘

Error::TypeTiny.


πŸ’œ AUTHOR πŸ’œ

Toby Inkster <tobyink@cpan.org>.


This software is copyright (c) 2013-2014, 2017-2025 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay, open source periodt πŸ’…


⭐ DISCLAIMER OF WARRANTIES ⭐

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

okay so this part is in all caps for a reason bestie β€” no warranties, none, zero, nada. use it, love it, but don't come for anybody if it doesn't work out. 😭

and that's the whole page!! this was rendered by perl v5.42.0 on 2026-01-17, so if you're reading this from the future, hiii, hope the Perl is still perling 🫢✨

πŸ“¦ where this page comes from