Skip to content

fix: pass request_id to caller in result_info also on RPC call error #86

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 1 commit 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 libs/wampcc/wamp_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1884,6 +1884,7 @@ void wamp_session::process_inbound_error(json_array & msg)
{
result_info info;
info.was_error = true;
info.request_id = request_id;
info.error_uri = error_uri;
info.user = orig_request.user;
if ( msg.size() > 5 )
Expand Down
5 changes: 4 additions & 1 deletion tests/wampcc/test_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ result_info sync_rpc_all(std::shared_ptr<wamp_session>&session,

std::promise<result_info> result_prom;
std::future<result_info> result_fut = result_prom.get_future();
session->call(rpc_name, {}, call_args,
t_request_id request_id = session->call(rpc_name, {}, call_args,
[&result_prom](wamp_session&, result_info r) {
result_prom.set_value(r);
});
Expand All @@ -392,6 +392,9 @@ result_info sync_rpc_all(std::shared_ptr<wamp_session>&session,
if (expect==rpc_result_expect::fail && result.was_error==false)
throw std::runtime_error("expected call to fail");

if (result.request_id != request_id)
throw std::runtime_error("result.request_id different from session->call() return");

return result;
}

Expand Down