Skip to content

Commit 0855a90

Browse files
remove anyhow wrapping from examples
1 parent 907e6d9 commit 0855a90

7 files changed

Lines changed: 8 additions & 15 deletions

File tree

crates/sdk/examples/activity_heartbeating/workflows.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@ impl HeartbeatingWorkflow {
5252
.heartbeat_timeout(Duration::from_secs(5))
5353
.build(),
5454
)
55-
.await
56-
.map_err(|e| anyhow::anyhow!("{e}"))?;
55+
.await?;
5756
Ok(result)
5857
}
5958
}

crates/sdk/examples/cancellation/workflows.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ impl CancellationWorkflow {
6464
(),
6565
ActivityOptions::start_to_close_timeout(Duration::from_secs(10)),
6666
)
67-
.await
68-
.map_err(|e| anyhow::anyhow!("{e}"))?;
67+
.await?;
6968

7069
Ok(format!("Cancelled (reason={reason}), {cleanup_result}"))
7170
}

crates/sdk/examples/hello_world/workflows.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ impl HelloWorldWorkflow {
2020
name,
2121
ActivityOptions::start_to_close_timeout(Duration::from_secs(10)),
2222
)
23-
.await
24-
.map_err(|e| anyhow::anyhow!("{e}"))?;
23+
.await?;
2524
Ok(greeting)
2625
}
2726
}

crates/sdk/examples/local_activities/workflows.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ impl LocalActivitiesWorkflow {
3333
name.clone(),
3434
ActivityOptions::start_to_close_timeout(Duration::from_secs(10)),
3535
)
36-
.await
37-
.map_err(|e| anyhow::anyhow!("{e}"))?;
36+
.await?;
3837

3938
let local_result = ctx
4039
.start_local_activity(
@@ -45,8 +44,7 @@ impl LocalActivitiesWorkflow {
4544
..Default::default()
4645
},
4746
)
48-
.await
49-
.map_err(|e| anyhow::anyhow!("{e}"))?;
47+
.await?;
5048

5149
Ok((remote_result, local_result))
5250
}

crates/sdk/examples/polling/workflows.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ impl PollingWorkflow {
3434
for attempt in 1..=max_attempts {
3535
let is_ready = ctx
3636
.start_activity(PollingActivities::check_condition, attempt, activity_opts())
37-
.await
38-
.map_err(|e| anyhow::anyhow!("{e}"))?;
37+
.await?;
3938

4039
if is_ready {
4140
return Ok(format!("Condition met on attempt {attempt}"));

crates/sdk/examples/schedules/workflows.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ impl ScheduledWorkflow {
3030
name,
3131
ActivityOptions::start_to_close_timeout(Duration::from_secs(10)),
3232
)
33-
.await
34-
.map_err(|e| anyhow::anyhow!("{e}"))?;
33+
.await?;
3534
Ok(greeting)
3635
}
3736
}

crates/sdk/examples/timer_examples/workflows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl TimerWorkflow {
3737
100u64,
3838
ActivityOptions::start_to_close_timeout(Duration::from_secs(30)),
3939
) => {
40-
result.map_err(|e| anyhow::anyhow!("{e}"))?;
40+
result?;
4141
"activity"
4242
}
4343
};

0 commit comments

Comments
 (0)