How do I trap a crash?

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


-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0
perl6
1/11/2019 5:54:10 PM
perl.perl6.users 1125 articles. 0 followers. Follow

2 Replies
3 Views

Similar Articles

[PageSpeed] 34

Perhaps https://docs.perl6.org/language/exceptions#Catching_exceptions =
could be enlightening?

> On 11 Jan 2019, at 18:54, ToddAndMargo via perl6-users =
<perl6-users@perl.org> wrote:
>=20
> Hi All,
>=20
> I would like to do a Send Notify when a program of mine
> crashes.
>=20
> How do I trap a crash?
>=20
> Is there a way to see some of the local variables in the
> sub that crashes with the trap?
>=20
>=20
> Many thanks,
> -T
>=20
>=20
> --=20
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Computers are like air conditioners.
> They malfunction when you open windows
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0
liz
1/11/2019 6:56:13 PM
 >> 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 https://docs.perl6.org/language/exceptions#Catching_exceptions could be enlightening?
> 
>> On 11 Jan 2019, at 18:54, ToddAndMargo via perl6-users <perl6-users@perl.org> wrote:


Yes. Thank you!

CATCH {
      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 = &?ROUTINE.name;

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


Many thanks,
-T
0
perl6
1/11/2019 7:05:35 PM
Reply: