Skip to content

feat: error boundary in render() — never-blank guarantee - #49

Merged
topspinj merged 1 commit into
mainfrom
feat/render-error-boundary
Jul 5, 2026
Merged

topspinj merged 1 commit into
mainfrom
feat/render-error-boundary

Conversation

@topspinj

@topspinj topspinj commented Jul 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Wraps computeLayout + renderSVG in render() with a try/catch: an internal throw now renders a minimal error-state SVG ("Diagram failed to render" + message) instead of propagating and leaving the target blank. Closes feat: error boundary in render() — never-blank guarantee #11.
  • Adds error?: Error to RenderResult so callers can detect it.
  • strict: true behavior is unchanged — parse errors still throw FloraParseError before rendering starts.
  • Docs: render() signature, never-blank note, and Types table updated in docs.astro.

Test plan

  • New test file mocks computeLayout to throw and asserts an SVG is still attached, result.error is returned, and warnings survive
  • Full suite: 142 passed; tsc --noEmit clean; site builds

🤖 Generated with Claude Code

Layout and SVG rendering are now wrapped in a try/catch; an internal
throw renders an error-state SVG and returns the caught error on
RenderResult instead of leaving the target blank. Closes #11.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@topspinj
topspinj merged commit fd28d30 into main Jul 5, 2026
4 checks passed
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.

feat: error boundary in render() — never-blank guarantee

1 participant