Is it possible to add a CONTROL phaser from a trait?
Following the example from the docs, it's simple to add a custom control exception in runtime code:
class CX::Oops does X::Control {};
sub f { CONTROL { when CX::Oops { note 'Oops!'; .resume}}
CX::Oops.new.throw; }
f; # OUTPUT: «Oops»
However, my attempts to do so from a trait haven't worked:
sub trait_mod:<is>(Sub $fn, :$oopsable) {
$fn.add_phaser: 'CONTROL', { when CX::Oops { note 'Oops!'; .resume} }}
sub g is oopsable { CX::Oops.new.throw; }
g; # OUTPUT: «control exception without handler»
From the .has_phasers and fire_phasers (fun name!) methods, I can tell that this is adding the control phaser. Do I need to do something to register it as a handler, or is there something else I'm missing?