1Error::TypeTiny::AssertUisoenr(3C)ontributed Perl DocumeEnrtraotri:o:nTypeTiny::Assertion(3)
2
3
4
6 Error::TypeTiny::Assertion - exception when a value fails a type
7 constraint
8
10 This module is covered by the Type-Tiny stability policy.
11
13 This exception is thrown when a value fails a type constraint
14 assertion.
15
16 This package inherits from Error::TypeTiny; see that for most
17 documentation. Major differences are listed below:
18
19 Attributes
20 "type"
21 The type constraint that was checked against. Weakened links are
22 involved, so this may end up being "undef".
23
24 "value"
25 The value that was tested.
26
27 "varname"
28 The name of the variable that was checked, if known. Defaults to
29 '$_'.
30
31 "attribute_name"
32 If this exception was thrown as the result of an isa check or a
33 failed coercion for a Moo attribute, then this will tell you which
34 attribute (if your Moo is new enough).
35
36 (Hopefully one day this will support other OO frameworks.)
37
38 "attribute_step"
39 If this exception was thrown as the result of an isa check or a
40 failed coercion for a Moo attribute, then this will contain either
41 "isa check" or "coercion" to indicate which went wrong (if your Moo
42 is new enough).
43
44 (Hopefully one day this will support other OO frameworks.)
45
46 Methods
47 "has_type", "has_attribute_name", "has_attribute_step"
48 Predicate methods.
49
50 "message"
51 Overridden to add "varname" to the message if defined.
52
53 "explain"
54 Attempts to explain why the value did not pass the type constraint.
55 Returns an arrayref of strings providing step-by-step reasoning; or
56 returns undef if no explanation is possible.
57
59 Please report any bugs to
60 <http://rt.cpan.org/Dist/Display.html?Queue=Type-Tiny>.
61
63 Error::TypeTiny.
64
66 Toby Inkster <tobyink@cpan.org>.
67
69 This software is copyright (c) 2013-2014, 2017-2019 by Toby Inkster.
70
71 This is free software; you can redistribute it and/or modify it under
72 the same terms as the Perl 5 programming language system itself.
73
75 THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
76 WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
77 MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
78
79
80
81perl v5.30.0 2019-07-26 Error::TypeTiny::Assertion(3)