Skip to content

Commit 802d96c

Browse files
fix: replace unwrap() with ok_or_else() in execute_job to prevent panic on missing prompt/instructions
Signed-off-by: Marlon Barreto <mbarretot@hotmail.com>
1 parent 717d17a commit 802d96c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crates/goose/src/scheduler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ async fn execute_job(
782782
.prompt
783783
.as_ref()
784784
.or(recipe.instructions.as_ref())
785-
.unwrap();
785+
.ok_or_else(|| anyhow!("Recipe must have either 'prompt' or 'instructions' set"))?;
786786

787787
let user_message = Message::user().with_text(prompt_text);
788788
let mut conversation = Conversation::new_unvalidated(vec![user_message.clone()]);

0 commit comments

Comments
 (0)