As you can see from the routine page for "payload": https://docs.perl6.org/routine/payload
it only exists on X::AdHoc, which if you follow the link "from X::AdHoc" explains: X::AdHoc is the type into which objects are wrapped if they are thrown as exceptions, but don't inherit from Exception. In your case you have a proper exception, i.e. the X::TypeCheck::Assignment In this case you'll probably want .message instead. .message on X::AdHoc will call .Str on the payload and return that, which is basically the same thing you wanted to do with the payload with PrintRedErr("$Payload\n") anyway. On top of that, every Exception object implements message. Hope that helps! - Timo On 28/02/2019 12:46, ToddAndMargo via perl6-users wrote: > Hi All, > > https://docs.perl6.org/language/exceptions#Catching_exceptions > > I am trying to place .payload into a variable `my $Payload = .payload;` > > > CATCH { > # Reference: > https://docs.perl6.org/language/exceptions#Catching_exceptions > my $NotifyStr; > my $Payload = .payload; > > default { > # $*ERR.say: .payload; > PrintRedErr( "$Payload\n" ); > $NotifyStr = $Payload; > for .backtrace.reverse { > next if .file.starts-with('SETTING::'); > next unless .subname; > # $*ERR.say: " in block {.subname} at {.file} line {.line}"; > PrintRedErr( " in block {.subname} at {.file} line > {.line}\n" ); > } > } > RunNoShell( "notify-send -u critical -t 0 -i \"$AlarmJpg\" \"CATCH > Trap \" \"$NotifyStr\"" ); > } > > > But keep pulling the following error: > > No such method 'payload' for invocant of type > 'X::TypeCheck::Assignment' in block <unit> > at ./GetUpdates.pl6 line 60 > > Line 60 is `my $Payload = .payload;` > > What am I doing wrong? > > Many thanks, > -T