{'src': {'__init__.py': '', 'application': {'__init__.py': ''}, 'delivery': {'__init__.py': '', 'api': {'__init__.py': '', 'application.py': 'from fastapi import FastAPI, Request\nfrom fastapi.responses import JSONResponse\n\n\napp = FastAPI()\n\n@app.exception_handler(Exception)\nasync def unexpected_exception_handler(_: Request, exc: Exception) -> JSONResponse:\n\treturn HttpResponse.internal_error(exc)\n\n\n@app.exception_handler(DomainError)\nasync def domain_error_handler(_: Request, exc: DomainError) -> JSONResponse:\n\treturn HttpResponse.domain_error(exc, status_code=StatusCode.BAD_REQUEST)'}}, 'infra': {'__init__.py': '', 'http': {'__init__.py': '', 'http_response.py': 'from fastapi.responses import JSONResponse\n\n\nclass HttpResponse:\n\t@staticmethod\n\tdef domain_error(error: DomainError, status_code: StatusCode) -> JSONResponse:\n\t\treturn JSONResponse(content={"error": error.to_primitives()}, status_code=status_code)\n\n\t@staticmethod\n\tdef internal_error(error: Exception) -> JSONResponse:\n\t\treturn JSONResponse(\n\t\t\tcontent={"error": "Internal server error"},\n\t\t\tstatus_code=StatusCode.INTERNAL_SERVER_ERROR,\n\t\t)\n\n\t@staticmethod\n\tdef created(resource: str) -> JSONResponse:\n\t\treturn JSONResponse(content={"resource": resource}, status_code=StatusCode.CREATED)\n\n\t@staticmethod\n\tdef ok(content: dict) -> JSONResponse:\n\t\treturn JSONResponse(content=content, status_code=StatusCode.OK)\n'}}}}
