Improve template syntax error output - #10387
Open
officialasishkumar wants to merge 1 commit into
Open
Conversation
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.
Contributor
|
Hello officialasishkumar! Thanks for the pull request! Here is what will happen next:
Thank you for contributing! |
Contributor
There was a problem hiding this comment.
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’sDisplayimplementation to renderTemplateErrorviato_string()rather thanDebugoutput. - Add a regression unit test ensuring template syntax errors do not include raw
TemplateError { ... }debug formatting and still mention the template name.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TemplateErrorstructs 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_outputFixes #1677.