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

Reply via email to