On 3/1/19 11:58 AM, ToddAndMargo via perl6-users wrote:
On 2/28/19 3:46 AM, ToddAndMargo via perl6-users wrote:

Follow up.  Thank yo for the Help!  My rewrite:


CATCH {
   # Reference: https://docs.perl6.org/language/exceptions#Catching_exceptions
    my $Message = .message;
    my $Message2;

   # for $Payload.comb -> $y { print "$y=", ord( $y ), " " }; print "\n\n";    # 27 [=91 3=51 2=50 m=109 ⏏=9167 27 [=91 3=51 1=49 m=109   Note: 27 is escape

    # notify-send does to like escape (27) sequences, so whack them
    $Message2 = $Message;
    $Message2 ~~ s:global/ "{chr(27)}" .... //;
   RunNoShell( "notify-send -u critical -t 0 -i \"$AlarmJpg\" \"CATCH Trap \" \"$Message2\"" );

    default {
       # $*ERR.say: .Message;
       PrintRedErr( "$Message\n" );
       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" );
       }
    }
}



Problem!   The line numbers reported are about 15 line shy of the
actual error.  I put this sub in the beginning of the program.

Should I move to to the end of the program?

Reply via email to