Skip to content

Commit 0bb0e9c

Browse files
authored
Enhance error handling in workflow execution error messages (#2517)
* Enhance error handling in workflow execution by truncating detailed error messages. The user will now see only the concise error message, e.g. Could not start workflow 'dog-fact-ingest': status: AlreadyExists, message: Workflow execution is already running. WorkflowId: dog-fact-ingest, RunId: ... * Simplify error messages by removing unnecessary details. The user will now see a more concise error message when a workflow fails to start. * Fix for Clippy
1 parent 5c22884 commit 0bb0e9c

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

apps/framework-cli/src/cli/routines/scripts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ pub async fn run_workflow(
114114
RoutineFailure::new(
115115
Message {
116116
action: "Workflow".to_string(),
117-
details: format!("Could not start workflow '{name}': {e}\n"),
117+
details: format!("Could not start workflow '{name}': {e}"),
118118
},
119119
e,
120120
)

apps/framework-cli/src/infrastructure/orchestration/temporal_client.rs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,30 @@ impl TemporalClient {
176176
) -> Result<String> {
177177
match self {
178178
TemporalClient::Standard(client) => {
179-
let response = client
179+
match client
180180
.start_workflow_execution(tonic::Request::new(request))
181-
.await?;
182-
Ok(response.into_inner().run_id)
181+
.await
182+
{
183+
Ok(response) => Ok(response.into_inner().run_id),
184+
Err(status) => {
185+
let concise_msg =
186+
format!("status: {:?}, message: {}", status.code(), status.message());
187+
Err(anyhow::Error::msg(concise_msg))
188+
}
189+
}
183190
}
184191
TemporalClient::WithInterceptor(client) => {
185-
let response = client
192+
match client
186193
.start_workflow_execution(tonic::Request::new(request))
187-
.await?;
188-
Ok(response.into_inner().run_id)
194+
.await
195+
{
196+
Ok(response) => Ok(response.into_inner().run_id),
197+
Err(status) => {
198+
let concise_msg =
199+
format!("status: {:?}, message: {}", status.code(), status.message());
200+
Err(anyhow::Error::msg(concise_msg))
201+
}
202+
}
189203
}
190204
}
191205
}

0 commit comments

Comments
 (0)