Implement uh... try/catch sorta
This commit is contained in:
parent
9c847637d2
commit
8c78834b61
|
@ -94,9 +94,10 @@ any [qw{GET POST}], '/sign' => sub ($c) {
|
|||
elsif (app->mode() eq 'production' && -s '.tom.url') {
|
||||
my ($new_message_id, $url_file, $url, $webhook);
|
||||
|
||||
eval {
|
||||
$new_message_id = $c->message->get_last_message_id();
|
||||
|
||||
open($url_file, '.tom.url') || die "$@";
|
||||
open($url_file, '.tom.url');
|
||||
chomp($url = <$url_file>);
|
||||
|
||||
$webhook = WebService::Discord::Webhook->new(
|
||||
|
@ -108,6 +109,11 @@ any [qw{GET POST}], '/sign' => sub ($c) {
|
|||
'content',
|
||||
"https://guestbook.swagg.net/message/$new_message_id"
|
||||
);
|
||||
} or do {
|
||||
$@ //= 'unknown error';
|
||||
|
||||
say "WEBHOOK URL $url FAILED: $@";
|
||||
}
|
||||
}
|
||||
|
||||
return $c->redirect_to(page => {page => 'view'});
|
||||
|
|
Loading…
Reference in a new issue