I was just looking into doing some finer-grained exception handling, so I tried this:
use v6; try { my $result = 4/0; say "result: $result"; CATCH { # when DivideByZero { say "Oh, you know."; } default { say .WHAT; .Str.say } # (DivideByZero) Attempt to divide 4 by zero using div } } The first time through, The .WHAT tells me I've got "DivideByZero", and so I added the line that's commented out here, at which point I got the error: ===SORRY!=== Function 'DivideByZero' needs parens to avoid gobbling block (or perhaps it's a class that's not declared or available in this scope?) Putting parens around (DivideByZero) doesn't help: Undeclared name: DivideByZero used at line 12 My impression was this would just work from looking at the examples using things like X::AdHoc here: https://docs.perl6.org/language/exceptions