Skip to content

Commit

Permalink
Improve cryptic error messages for when a user tries to create_sessio…
Browse files Browse the repository at this point in the history
…n or destroy_session from a non-owner thread
  • Loading branch information
anujkaliaiitd committed Nov 5, 2021
1 parent ae8724b commit c0a9fd5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/rpc_impl/rpc_sm_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ int Rpc<TTr>::create_session_st(std::string remote_uri, uint8_t rem_rpc_id) {

// Check that the caller is the creator thread
if (!in_dispatch()) {
ERPC_WARN("%s: Caller thread is not the creator thread.\n", issue_msg);
ERPC_WARN(
"%s: Cannot create session from a thread other than the one that "
"created this erpc::Rpc object.\n",
issue_msg);
return -EPERM;
}

Expand Down Expand Up @@ -81,7 +84,10 @@ int Rpc<TTr>::destroy_session_st(int session_num) {
session_num);

if (!in_dispatch()) {
ERPC_WARN("%s: Caller thread is not creator.\n", issue_msg);
ERPC_WARN(
"%s: Can't destroy session from a thread other than the one that "
"created this erpc::Rpc object.\n",
issue_msg);
return -EPERM;
}

Expand Down

0 comments on commit c0a9fd5

Please sign in to comment.