Skip to content

Commit

Permalink
Catching exception
Browse files Browse the repository at this point in the history
  • Loading branch information
dbrasseur-aneo committed Jul 28, 2023
1 parent 53b4b9c commit c64a5b8
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions packages/cpp/ArmoniK.Api.Worker/source/Worker/ArmoniKWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,23 @@ Status API_WORKER_NAMESPACE::ArmoniKWorker::Process([[maybe_unused]] ::grpc::Ser
TaskHandler task_handler(agent, iterator);

task_handler.init();
try {
ProcessStatus status = Execute(task_handler);

ProcessStatus status = Execute(task_handler);
logger_.debug("Finish call C++");

logger_.debug("Finish call C++");
armonik::api::grpc::v1::Output output;
if (status.ok()) {
*output.mutable_ok() = armonik::api::grpc::v1::Empty();
} else {
output.mutable_error()->set_details(status.details());
}

armonik::api::grpc::v1::Output output;
if (status.ok()) {
*output.mutable_ok() = armonik::api::grpc::v1::Empty();
} else {
output.mutable_error()->set_details(status.details());
*response->mutable_output() = output;
} catch (const std::exception &e) {
return {grpc::StatusCode::UNAVAILABLE, "Error processing task", e.what()};
}

*response->mutable_output() = output;

return grpc::Status::OK;
}

Expand Down

0 comments on commit c64a5b8

Please sign in to comment.