Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /tyvekzhang_fastlib /fastlib /exception /exception_manager.py
| # SPDX-License-Identifier: MIT | |
| """Common module exception""" | |
| from fastapi import FastAPI | |
| from fastapi.exceptions import RequestValidationError | |
| from jwt import PyJWTError | |
| from pydantic_core._pydantic_core import ValidationError # noqa | |
| from starlette.exceptions import HTTPException as StarletteHTTPException | |
| from fastlib.exception import exception_handler | |
| from fastlib.exception.base import BaseException | |
| def register_exception_handlers(app: FastAPI) -> None: | |
| """Register all exception handlers to the FastAPI application""" | |
| # Register handlers using add_exception_handler method | |
| app.add_exception_handler(Exception, exception_handler.global_exception_handler) | |
| app.add_exception_handler( | |
| ValidationError, exception_handler.validation_exception_handler | |
| ) | |
| app.add_exception_handler(BaseException, exception_handler.custom_exception_handler) | |
| app.add_exception_handler( | |
| StarletteHTTPException, exception_handler.custom_http_exception_handler | |
| ) | |
| app.add_exception_handler( | |
| RequestValidationError, | |
| exception_handler.request_validation_exception_handler, | |
| ) | |
| app.add_exception_handler(PyJWTError, exception_handler.jwt_exception_handler) | |
Xet Storage Details
- Size:
- 1.21 kB
- Xet hash:
- b1a44d074e7b78cf3225e38fc21bbba2a731778d65f457c72b6cdece8f7697c1
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.