develooper Front page | perl.perl6.users | Postings from January 2019

Re: How do I trap a crash?

Thread Previous
ToddAndMargo via perl6-users
January 11, 2019 19:05
Re: How do I trap a crash?
Message ID:
 >> Hi All,
 >> I would like to do a Send Notify when a program of mine
 >> crashes.
 >> How do I trap a crash?
 >> Is there a way to see some of the local variables in the
 >> sub that crashes with the trap?
 >> Many thanks,
 >> -T

On 1/11/19 10:56 AM, Elizabeth Mattijsen wrote:
> Perhaps could be enlightening?
>> On 11 Jan 2019, at 18:54, ToddAndMargo via perl6-users <> wrote:

Yes. Thank you!

      default {
          $*ERR.say: .payload;
          for .backtrace.reverse {
              next if .file.starts-with('SETTING::');
              next unless .subname;
              $*ERR.say: "  in block {.subname} at {.file} line {.line}";

Does the program die afterward?

Each of my subs has

    my Str $SubName = &?;

Is there a way to get that in the printout from CATCH?

Many thanks,

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About