Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for CustomError (0.23 sec)

  1. tests/test_dependency_after_yield_raise.py

    from typing import Annotated, Any
    
    import pytest
    from fastapi import Depends, FastAPI, HTTPException
    from fastapi.testclient import TestClient
    
    
    class CustomError(Exception):
        pass
    
    
    def catching_dep() -> Any:
        try:
            yield "s"
        except CustomError as err:
            raise HTTPException(status_code=418, detail="Session error") from err
    
    
    def broken_dep() -> Any:
        yield "s"
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 1.7K bytes
    - Viewed (0)
Back to top