Skip to content

Commit

Permalink
rpc: Prefix rpcwaittimeout error with details on its nature
Browse files Browse the repository at this point in the history
As proposed by @laanwj the error message is now prefixed with the
"timeout on transient error:" prefix, to explain why the error is
suddenly considered terminal.
  • Loading branch information
cdecker committed Jun 3, 2021
1 parent c490e17 commit f76cb10
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bitcoin-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,12 +809,12 @@ static UniValue ConnectAndCallRPC(BaseRequestHandler* rh, const std::string& str
}
}
break; // Connection succeeded, no need to retry.
} catch (const CConnectionFailed&) {
} catch (const CConnectionFailed& e) {
const int64_t now = GetTime<std::chrono::seconds>().count();
if (fWait && (timeout <= 0 || now < deadline)) {
UninterruptibleSleep(std::chrono::seconds{1});
} else {
throw;
throw CConnectionFailed(strprintf("timeout on transient error: %s", e.what()));
}
}
} while (fWait);
Expand Down

0 comments on commit f76cb10

Please sign in to comment.