Skip to content

fix: clearer error when partial registered on wrong Handlebars instance (issue #545)#622

Merged
rexm merged 2 commits into
masterfrom
worktree-agent-a3acd1bfa0c840893
Jun 20, 2026
Merged

fix: clearer error when partial registered on wrong Handlebars instance (issue #545)#622
rexm merged 2 commits into
masterfrom
worktree-agent-a3acd1bfa0c840893

Conversation

@rexm

@rexm rexm commented Jun 20, 2026

Copy link
Copy Markdown
Member

Fixes #545

Summary

  • Improved the HandlebarsRuntimeException message thrown when a partial cannot be resolved. The new message now includes a diagnostic hint pointing to the common pitfall of registering a partial on the static Handlebars class but compiling/rendering on a separate IHandlebars instance.
  • Added quotes around the partial name in the error message for readability.
  • Updated two existing tests in PartialTests.cs that asserted the exact old message format (changed to Assert.StartsWith to be forward-compatible).
  • Added two new regression tests in IssueTests.cs for issue Unable to render Partial HandelBarReuntimeException #545.

Before:

Referenced partial name staticContent could not be resolved

After:

Referenced partial name 'staticContent' could not be resolved. If you registered the partial on the static Handlebars class, make sure to also compile and render using the same static class (or register the partial on the IHandlebars instance you are using to compile).

Test plan

  • Issue545_PartialRegisteredOnInstanceIsFoundDuringRender — verifies the correct same-instance usage works
  • Issue545_MixingStaticAndInstanceGivesHelpfulError — verifies the improved error message is shown when mixing static and instance APIs
  • All 1748 existing tests continue to pass

🤖 Generated with Claude Code

rexm and others added 2 commits June 19, 2026 20:55
…ce (issue #545)

Improved the HandlebarsRuntimeException message thrown when a partial cannot be resolved to include a diagnostic hint about the common pitfall of registering a partial on the static Handlebars class but compiling/rendering on a separate IHandlebars instance. Also added quotes around the partial name for readability.

Added two regression tests for issue #545 covering both the correct same-instance pattern and the helpful error when mixing static and instance APIs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@rexm rexm enabled auto-merge June 20, 2026 21:31
@sonarqubecloud

Copy link
Copy Markdown

@rexm rexm merged commit 3aa4e8d into master Jun 20, 2026
7 checks passed
@rexm rexm deleted the worktree-agent-a3acd1bfa0c840893 branch June 20, 2026 21:43
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.

Unable to render Partial HandelBarReuntimeException

1 participant