Skip to content

Improve template syntax error output - #10387

Open
officialasishkumar wants to merge 1 commit into
habitat-sh:mainfrom
officialasishkumar:improve-template-error-output
Open

Improve template syntax error output#10387
officialasishkumar wants to merge 1 commit into
habitat-sh:mainfrom
officialasishkumar:improve-template-error-output

Conversation

@officialasishkumar

Copy link
Copy Markdown

Summary

  • Display Handlebars template syntax errors with their user-facing message instead of raw Debug output.
  • Add a regression test for malformed templates so raw TemplateError structs are not printed.

Testing

  • GIT_CONFIG_GLOBAL=/dev/null CARGO_NET_GIT_FETCH_WITH_CLI=true cargo test -p habitat_common template_errors_do_not_display_debug_output

Fixes #1677.

Display handlebars template registration errors with their user-facing message instead of Debug output. This avoids exposing the raw TemplateError struct when malformed config templates are parsed.
Copilot AI review requested due to automatic review settings May 12, 2026 05:22
@officialasishkumar
officialasishkumar requested a review from a team as a code owner May 12, 2026 05:22
@chef-expeditor

Copy link
Copy Markdown
Contributor

Hello officialasishkumar! Thanks for the pull request!

Here is what will happen next:

  1. Your PR will be reviewed by the maintainers.
  2. If everything looks good, one of them will approve it, and your PR will be merged.

Thank you for contributing!

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 improves end-user error output for Handlebars template syntax failures in habitat_common by switching from Rust Debug formatting (which exposes internal struct details) to the template error’s Display message, aligning with the UX issue reported in #1677.

Changes:

  • Update habitat_common::error::Error’s Display implementation to render TemplateError via to_string() rather than Debug output.
  • Add a regression unit test ensuring template syntax errors do not include raw TemplateError { ... } debug formatting and still mention the template name.

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.

[UX] Improve error message during generation of configuration

2 participants