class X::Numeric::CannotConvert

Error while trying to coerce a number to another type
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.

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.