Skip to content

refactor: consolidate recipeError#6758

Merged
lifeizhou-ap merged 1 commit intomainfrom
lifei/refactor-recipe-error
Jan 28, 2026
Merged

refactor: consolidate recipeError#6758
lifeizhou-ap merged 1 commit intomainfrom
lifei/refactor-recipe-error

Conversation

@lifeizhou-ap
Copy link
Collaborator

Summary

Why
When user runs Goose CLI, when there is some error in template, it will show error message

Error: Template rendering failed: syntax error: unknown statement ifw (in recipe_template:168)

This is not intuitive to user because templating is the implementation details and is not intuitive to some users.

What

  • Consolidate the RecipeParsing and TemplateRendering Error in Recipe Error to Invalid Error and provide better message
  • rename the internal template name to recipe

After change, the error message is

Error: Invalid recipe: syntax error: unknown statement ifw (in recipe:168)

Type of Change

  • Feature
  • Bug fix
  • Refactor / Code quality
  • Performance improvement
  • Documentation
  • Tests
  • Security fix
  • Build / Release
  • Other (specify below)

AI Assistance

  • This PR was created or reviewed with AI assistance

Testing

Unit test

Copilot AI review requested due to automatic review settings January 28, 2026 00:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates recipe error types to improve user-facing error messages by hiding implementation details. It merges RecipeError::TemplateRendering and RecipeError::RecipeParsing into a single RecipeError::Invalid variant, and renames the internal template name from "recipe_template" to "recipe".

Changes:

  • Consolidated two error variants (TemplateRendering and RecipeParsing) into a single Invalid variant for clearer error messages
  • Renamed internal template name constant from "recipe_template" to "recipe" to improve error message readability
  • Updated all test cases to match the new error variant

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
crates/goose/src/recipe/template_recipe.rs Changed CURRENT_TEMPLATE_NAME from "recipe_template" to "recipe" for better error messages
crates/goose/src/recipe/build_recipe/mod.rs Consolidated TemplateRendering and RecipeParsing error variants into single Invalid variant
crates/goose/src/recipe/build_recipe/tests.rs Updated all test assertions to expect RecipeError::Invalid instead of the old variants

Copy link
Collaborator

@zanesq zanesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lifeizhou-ap lifeizhou-ap merged commit cee4b1b into main Jan 28, 2026
22 of 23 checks passed
@lifeizhou-ap lifeizhou-ap deleted the lifei/refactor-recipe-error branch January 28, 2026 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants