Subject: | try {} doesn't catch error thrown by die |
I ran this test program:
#!/usr/bin/perl
use warnings;
use strict;
use 5.010;
use Error;
try { die 'x' }
otherwise { say "error: $_[0]" }
I expected it to print 'error: x' or similar, but instead it said 'x at
/home/eda/test line 7.'
Does a try block not work to catch exceptions thrown with die? Is an
otherwise block not the correct way to catch any exception thrown in the
try block? Perhaps I have misunderstood the documentation.