(0.6.22rc3) [halfapi] Log HTTPException with statuscode 500 as critical
This commit is contained in:
parent
b7e678e00f
commit
f0c898ba20
|
@ -5,6 +5,7 @@
|
||||||
- IMPORTANT : Fix bug introduced with 0.6.20 (fix arguments handling)
|
- IMPORTANT : Fix bug introduced with 0.6.20 (fix arguments handling)
|
||||||
- Add *html* return type as default argument ret_type
|
- Add *html* return type as default argument ret_type
|
||||||
- Add *txt* return type
|
- Add *txt* return type
|
||||||
|
- Log HTTPException with statuscode 500 as critical
|
||||||
|
|
||||||
|
|
||||||
## 0.6.21
|
## 0.6.21
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
__version__ = '0.6.22-rc2'
|
__version__ = '0.6.22-rc3'
|
||||||
|
|
||||||
def version():
|
def version():
|
||||||
return f'HalfAPI version:{__version__}'
|
return f'HalfAPI version:{__version__}'
|
||||||
|
|
|
@ -92,7 +92,7 @@ class HalfAPI(Starlette):
|
||||||
exception_handlers={
|
exception_handlers={
|
||||||
401: UnauthorizedResponse,
|
401: UnauthorizedResponse,
|
||||||
404: NotFoundResponse,
|
404: NotFoundResponse,
|
||||||
500: InternalServerErrorResponse,
|
500: HalfAPI.exception,
|
||||||
501: NotImplementedResponse,
|
501: NotImplementedResponse,
|
||||||
503: ServiceUnavailableResponse
|
503: ServiceUnavailableResponse
|
||||||
},
|
},
|
||||||
|
@ -148,8 +148,6 @@ class HalfAPI(Starlette):
|
||||||
starlette_app=self)
|
starlette_app=self)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def version(self):
|
def version(self):
|
||||||
return __version__
|
return __version__
|
||||||
|
@ -157,6 +155,11 @@ class HalfAPI(Starlette):
|
||||||
async def version_async(self, request, *args, **kwargs):
|
async def version_async(self, request, *args, **kwargs):
|
||||||
return Response(self.version)
|
return Response(self.version)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
async def exception(request: Request, exc: HTTPException):
|
||||||
|
logger.critical(exc, exc_info=True)
|
||||||
|
return InternalServerErrorResponse()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def application(self):
|
def application(self):
|
||||||
return self
|
return self
|
||||||
|
|
Loading…
Reference in New Issue