Skip to content

Add more details in warnings #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Revision history for Perl module Mojo::WebSocketProxy

{{$NEXT}}
Add warning with transaction details failure, if available.

0.06 2017-06-01 03:05:17+00:00 UTC
This introduces support for callbacks which return Future instances,
Expand Down
7 changes: 6 additions & 1 deletion lib/Mojo/WebSocketProxy/CallingEngine.pm
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,12 @@ sub call_rpc {

my $api_response;
if (!$res) {
warn "WrongResponse [$msg_type]";
my $tx = $client->tx;
my $details = 'URL: ' . $tx->req->url;
Copy link
Contributor

@raunakkathuria raunakkathuria Aug 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this check if tx object exists, like my $details = $tx ? 'URL: ' . $tx->req->url : ''; else it will give warnings

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for paying attention to that!

According to the implementation of MojoX::JSON::RPC::Client we shouldn't:

if (my $err = $tx->error) {
$details .= ', code: ' . ($err->{code} // 'n/a') . ', response: ' . $err->{message};
}
warn "WrongResponse [$msg_type], details: $details";
$api_response = $c->wsp_error($msg_type, 'WrongResponse', 'Sorry, an error occurred while processing your request.');
$c->send({json => $api_response}, $req_storage);
return;
Expand Down