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