Skip to content

Commit 10453f1

Browse files
Merge pull request #144 from code0-tech/#143-enhance-remote-runtime-errorsÜ
Enhance Remote Runtime Errors
2 parents 72814d9 + 5675539 commit 10453f1

2 files changed

Lines changed: 25 additions & 8 deletions

File tree

crates/manual/src/main.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,28 @@ impl RemoteRuntime for RemoteNatsClient {
3838
let message = match res {
3939
Ok(r) => r,
4040
Err(err) => {
41-
return Err(RuntimeError::simple(
41+
log::error!(
42+
"RemoteRuntimeExeption: failed to handle NATS message: {}",
43+
err
44+
);
45+
return Err(RuntimeError::simple_str(
4246
"RemoteRuntimeExeption",
43-
format!("Failed to handle NATS message {:?}", err),
47+
"Failed to receive any response messages from a remote runtime.",
4448
));
4549
}
4650
};
4751

4852
let decode_result = ExecutionResult::decode(message.payload);
4953
let execution_result = match decode_result {
5054
Ok(r) => r,
51-
Err(_) => {
55+
Err(err) => {
56+
log::error!(
57+
"RemoteRuntimeExeption: failed to decode NATS message: {}",
58+
err
59+
);
5260
return Err(RuntimeError::simple_str(
5361
"RemoteRuntimeExeption",
54-
"Failed to decode NATS message",
62+
"Failed to read Remote Response",
5563
));
5664
}
5765
};

crates/taurus/src/remote/mod.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,33 @@ impl RemoteRuntime for RemoteNatsClient {
2626
) -> Result<Value, RuntimeError> {
2727
let topic = format!("action.{}.{}", remote_name, request.execution_identifier);
2828
let payload = request.encode_to_vec();
29+
log::info!("Publishing to topic: {}", topic);
2930
let res = self.client.request(topic, payload.into()).await;
3031
let message = match res {
3132
Ok(r) => r,
32-
Err(_) => {
33+
Err(err) => {
34+
log::error!(
35+
"RemoteRuntimeExeption: failed to handle NATS message: {}",
36+
err
37+
);
3338
return Err(RuntimeError::simple_str(
3439
"RemoteRuntimeExeption",
35-
"Failed to handle NATS message",
40+
"Failed to receive any response messages from a remote runtime.",
3641
));
3742
}
3843
};
3944

4045
let decode_result = ExecutionResult::decode(message.payload);
4146
let execution_result = match decode_result {
4247
Ok(r) => r,
43-
Err(_) => {
48+
Err(err) => {
49+
log::error!(
50+
"RemoteRuntimeExeption: failed to decode NATS message: {}",
51+
err
52+
);
4453
return Err(RuntimeError::simple_str(
4554
"RemoteRuntimeExeption",
46-
"Failed to decode NATS message",
55+
"Failed to read Remote Response",
4756
));
4857
}
4958
};

0 commit comments

Comments
 (0)