Skip to content

Commit

Permalink
Improve exception message for remote function failure (#6069)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #6069

Improve exception message for remote function failure to increase
debugability.

Reviewed By: kgpai

Differential Revision: D48212485

fbshipit-source-id: 0afd80e500beecafb5ba59b5dc471c83a7bb55be
  • Loading branch information
pedroerp authored and facebook-github-bot committed Aug 12, 2023
1 parent c275968 commit 87cc5bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion velox/functions/remote/client/Remote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,16 @@ class RemoteFunction : public exec::VectorFunction {
requestInputs->payload_ref() = rowVectorToIOBuf(
remoteRowVector, rows.end(), *context.pool(), serde_.get());

thriftClient_->sync_invokeFunction(remoteResponse, request);
try {
thriftClient_->sync_invokeFunction(remoteResponse, request);
} catch (const std::exception& e) {
VELOX_FAIL(
"Error while executing remote function '{}' at '{}': {}",
functionName_,
location_.describe(),
e.what());
}

auto outputRowVector = IOBufToRowVector(
remoteResponse.get_result().get_payload(),
ROW({outputType}),
Expand Down
4 changes: 2 additions & 2 deletions velox/functions/remote/client/tests/RemoteFunctionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,10 @@ TEST_P(RemoteFunctionTest, connectionError) {

// Check it throw and that the exception has the "connection refused"
// substring.
EXPECT_THROW(func(), VeloxUserError);
EXPECT_THROW(func(), VeloxRuntimeError);
try {
func();
} catch (const VeloxUserError& e) {
} catch (const VeloxRuntimeError& e) {
EXPECT_THAT(e.message(), testing::HasSubstr("Channel is !good()"));
}
}
Expand Down

0 comments on commit 87cc5bc

Please sign in to comment.