Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vladisavvv committed Feb 12, 2024
1 parent d67ac48 commit 1ce19f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
13 changes: 8 additions & 5 deletions aidial_sdk/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,11 @@ async def _healthcheck() -> JSONResponse:
return JSONResponse(content={"status": "ok"})

@staticmethod
def _exception_handler(request: Request, exc: HTTPException):
return JSONResponse(
status_code=exc.status_code,
content=exc.detail,
)
def _exception_handler(request: Request, exc: Exception):
if isinstance(exc, HTTPException):
return JSONResponse(
status_code=exc.status_code,
content=exc.detail,
)
else:
raise exc
3 changes: 2 additions & 1 deletion aidial_sdk/header_propagator.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
from fastapi import FastAPI
from requests import PreparedRequest
from requests.sessions import Session
from starlette.middleware import _MiddlewareClass
from starlette.middleware.exceptions import ExceptionMiddleware


class FastAPIMiddleware:
class FastAPIMiddleware(_MiddlewareClass):
def __init__(
self,
app: ExceptionMiddleware,
Expand Down

0 comments on commit 1ce19f0

Please sign in to comment.