File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ =begin pod :kind("Type") :subkind("class") :category("exception")
2
+
3
+ =TITLE class X::Numeric::CannotConvert
4
+
5
+ =SUBTITLE Error while trying to coerce a number to another type
6
+
7
+ class X::Numeric::CannotConvert is Exception { }
8
+
9
+ Occurs when an attempt to coerce a L<C<Inf>|/type/Num#Inf> or
10
+ a L<C<NaN>|/type/Num#NaN> to a L<C<Numeric>|/type/Numeric> type.
11
+
12
+
13
+ For example
14
+
15
+ say Inf.Int;
16
+ CATCH { default { put .^name, ': ', .Str } };
17
+ # OUTPUT: «X::Numeric::CannotConvert: Cannot convert Inf to Int»
18
+
19
+ Most other conversion errors throw L<C<X::Numeric::Real>|/type/X::Numeric::Real>.
20
+
21
+ =head1 Methods
22
+
23
+ =head2 method source
24
+
25
+ method source()
26
+
27
+ Returns the value that failed to coerce.
28
+
29
+ =head2 method target
30
+
31
+ method target()
32
+
33
+ Returns the type to which the coercion was attempted.
34
+
35
+ =head2 method reason
36
+
37
+ method reason(--> Str:D)
38
+
39
+ Returns the reason that the conversion failed.
40
+
41
+ =end pod
You can’t perform that action at this time.
0 commit comments