class X::Numeric::CannotConvert is Exception { }
Occurs when an attempt to coerce an Inf
or a NaN
to a Numeric
type.
For example
say Inf.Int; CATCH { default { put .^name, ': ', .Str } }; # OUTPUT: «X::Numeric::CannotConvert: Cannot convert Inf to Int»
Most other conversion errors throw X::Numeric::Real
.
Methods§
method source§
method source()
Returns the value that failed to coerce.
method target§
method target()
Returns the type to which the coercion was attempted.
method reason§
method reason(--> Str:D)
Returns the reason that the conversion failed.