Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Clarifies example in a control environment
This closes #2871; also closes #2551 since that's been cleared up already.
  • Loading branch information
JJ committed Jun 27, 2019
1 parent 5de7581 commit 16f2a19
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions doc/Type/X/Control.pod6
Expand Up @@ -18,22 +18,21 @@ This allows to define custom control exceptions.
For example, the custom C<CX::Oops> control exception we define below:
=begin code
class CX::Oops does X::Control {
class CX::Vaya does X::Control {
has $.message
}
sub oops ($message = 'oops') {
CX::Oops.new(:$message).throw
}
oops "I messed up!";
CONTROL {
default {
say "Controlled { .^name }: { .message }"
sub ea {
CONTROL {
default {
say "Controlled { .^name }: { .message }"
}
}
CX::Vaya.new( message => "I messed up!" ).throw;
}
# OUTPUT: «Controlled CX::Oops: I messed up!␤»
ea;
# OUTPUT: «Controlled CX::Vaya: I messed up!␤»
=end code
=end pod

0 comments on commit 16f2a19

Please sign in to comment.