Repository navigation
Conversation
An exception handler is a method marked with @winter.web.exception_handler; its first argument is annotated with the exceptions it handles. Adapters collect the handlers of an application from its definitions, over the built-in ones of winter.web, so two applications in one process no longer share them and the isolation test passes. BREAKING CHANGE: ExceptionHandler, exception_handlers_registry (add_handler, set_default_handler) and the handler argument of @raises are removed. Every handler handles its exceptions in all endpoints of its application, by the nearest class in the exception's MRO; a handler of Exception replaces the default 500 response. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Stacked on #343; retargets to
v34once #343 merges.An exception handler is a method marked with
@winter.web.exception_handler. Its first argument is annotated with the exceptions it handles (a union for several):create_urls(app)andgenerate_openapi(app)collect the handlers of the application fromapp.definitions(handler methods and@problemexceptions), over the built-in handlers ofwinter.web(500 forException, redirect, Winter's own problems). A handler of the application replaces the built-in one of the same exception class; then the handler of the nearest class in the exception's MRO handles it.@raises(Exc)only declares the response for OpenAPI.ExceptionHandler,exception_handlers_registry(add_handler,set_default_handler), the handler argument of@raises.tests/test_application_scope.pypasses;xfailis removed.@raises(X)for an exception without a handler now documents the built-in 500 response; before, the default handler's response overwrote the success response.🤖 Generated with Claude Code