Skip to content

feat(framework): add onError hook integration#62

Merged
qantrepreneur merged 1 commit into
mainfrom
15-on-error-hook
May 14, 2026
Merged

feat(framework): add onError hook integration#62
qantrepreneur merged 1 commit into
mainfrom
15-on-error-hook

Conversation

@qantrepreneur
Copy link
Copy Markdown
Contributor

Summary

  • Add handleRequest function that wraps the render pipeline with error handling
  • Catches RedirectResponse throwables and returns redirect responses
  • Catches HttpErrorResponse throwables and returns their error responses
  • Delegates unknown errors to user-defined onError(error, request) hook
  • Falls back to generic 500 response when no onError is defined
  • Export handleRequest from package index

Test plan

  • Redirect throwables are caught and returned as redirect Responses (302 + location header)
  • HttpError throwables are caught and returned with correct status/body
  • Unknown errors call onError(error, request) with correct arguments
  • onError can return a custom Response
  • Falls back to generic 500 when onError is not defined
  • Successful renders pass through unchanged
  • Async onError handlers are supported

Closes #15

🤖 Generated with Claude Code

Wire error handling into the render pipeline via handleRequest function.
Catches redirect/httpError throwables and delegates unknown errors to
the user-defined onError hook, falling back to a generic 500 response.

Closes #15

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@qantrepreneur qantrepreneur merged commit 78178b0 into main May 14, 2026
2 checks passed
@github-actions github-actions Bot mentioned this pull request May 14, 2026
qantrepreneur added a commit that referenced this pull request May 21, 2026
Wire error handling into the render pipeline via handleRequest function.
Catches redirect/httpError throwables and delegates unknown errors to
the user-defined onError hook, falling back to a generic 500 response.

Closes #15

Co-authored-by: Lorenzo <lorenzofkramer@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This was referenced May 23, 2026
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.

onError hook integration in render pipeline

1 participant