Add debug for api errors

This commit is contained in:
eleksir
2022-11-26 14:22:11 +03:00
parent 770fce4cfe
commit 9618369a45

View File

@@ -13,7 +13,7 @@ use English qw ( -no_match_vars );
use Mojo::IOLoop ();
use Mojo::JSON qw (true false);
use Mojo::UserAgent ();
use Carp qw/croak cluck confess/; # use croak where we return error up to app that supply something wrong
use Carp qw/carp croak cluck confess/; # use croak where we return error up to app that supply something wrong
# use cluck where we want to say that something bad but non-critical happen in
# lower layer (Mojo loop)
# use confess where we want to say that fatal error happen in lower layer (Mojo loop)
@@ -743,7 +743,14 @@ sub _post_request {
}
elsif ($res->is_error) {
# This can be non-fatal error: api change.
cluck 'Failed to post: ' . $res->message;
#cluck 'Failed to post: ' . $res->message;
carp 'Failed to post to: ' . $res->message;
carp sprintf (
"Input parameters: %s\nResonse Dump: %s\nURL:%s\n",
Dumper ($form_args),
Dumper ($res),
$url,
);
return 0; # to handle this as false in upper layers
}
else {