Skip to content

Instantly share code, notes, and snippets.

@tbrowder
Created October 26, 2023 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbrowder/86176edb54d584f8851b20325f796410 to your computer and use it in GitHub Desktop.
Save tbrowder/86176edb54d584f8851b20325f796410 to your computer and use it in GitHub Desktop.
Demo CATCH
sub resource-exists($path? --> Bool) is export {
return False if not $path.defined;
my $exists = $?DISTRIBUTION.content($path); # may die
return True if $exists;
}
{
my $return = resource-exists;
say "Returned $return";
CATCH {
default {
say "Error ", .^name, ': ',.Str;
$return = False;
.resume;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment