class X::Str::Match::x is Exception { }

Error thrown (or wrapped in a Failure) if an invalid type is passed to the :x argument of Str.match or Str.subst. Only Numeric and Range types are allowed.

For example

say "foobar".match("o",:x<hello>);
CATCH { default { put .^name''.Str } };
# OUTPUT: «X::Str::Match::x: in Str.match, got invalid value of type Str for :x, must be Int or Range␤»

Methods§

method source§

method got(--> Str:D)

Returns the type of the invalid argument.