raku-type-x-numeric-cannotconvert
class X::Numeric::CannotConvert is Exception { }
Inf이나 NaN을 Numeric 타입으로 강제 변환하려고 할 때 발생하는 예외예요.
예를 들어
say Inf.Int;
CATCH { default { put .^name, ': ', .Str } };
# OUTPUT: «X::Numeric::CannotConvert: Cannot convert Inf to Int»
이런 식으로 쓰면 이 예외가 나와요. 그 밖의 대부분의 변환 오류는 X::Numeric::Real을 던져요.
Methods
method source
method source()
강제 변환에 실패한 원래 값을 돌려줘요.
method target
method target()
강제 변환을 시도했던 대상 타입을 돌려줘요.
method reason
method reason(--> Str:D)
변환이 왜 실패했는지 그 이유를 돌려줘요.