class X::Numeric::DivideByZero

Error while trying to divide by zero
class X::Numeric::DivideByZero is Exception { }

Occurs when attempting to divide by zero.

For example:

say 1 / 0;
    CATCH { default { put .^name, ': ', .Str } };
    # OUTPUT: «X::Numeric::DivideByZero: Attempt to divide by zero when coercing Rational to Str␤»

Note that the error is only thrown when you attempt to do something with the result. A simple

1/0; # no Error

will only generate a silent Failure. It's the say in the first example that triggers the exception.

Methods

method using

method using()

If present, returns the name of the operator used, e.g. infix:<%%>.

method details

method details()

If present, contains some details on the operation that caused the failure.

method numerator

method numerator()

If present, returns the numerator of the operation.

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.