Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove common error handler from ExceptionMiddleware #1841

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions connexion/middleware/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class ExceptionMiddleware(StarletteExceptionMiddleware):
def __init__(self, next_app: ASGIApp):
super().__init__(next_app)
self.add_exception_handler(ProblemException, self.problem_handler) # type: ignore
self.add_exception_handler(Exception, self.common_error_handler)

def add_exception_handler(
self,
Expand Down Expand Up @@ -89,13 +88,5 @@ def http_exception(
headers=exc.headers,
)

@staticmethod
def common_error_handler(
_request: StarletteRequest, exc: Exception
) -> ConnexionResponse:
"""Default handler for any unhandled Exception"""
logger.error("%r", exc, exc_info=exc)
return InternalServerError().to_problem()

async def __call__(self, scope: Scope, receive: Receive, send: Send) -> None:
await super().__call__(scope, receive, send)
Loading