diff --git a/src/fastapi_oidc_op/store/exceptions.py b/src/fastapi_oidc_op/store/exceptions.py new file mode 100644 index 0000000..870abb4 --- /dev/null +++ b/src/fastapi_oidc_op/store/exceptions.py @@ -0,0 +1,2 @@ +class DuplicateError(Exception): + """Raised when a create operation violates a uniqueness constraint.""" diff --git a/tests/test_store/test_exceptions.py b/tests/test_store/test_exceptions.py new file mode 100644 index 0000000..dd1ec9b --- /dev/null +++ b/tests/test_store/test_exceptions.py @@ -0,0 +1,7 @@ +from fastapi_oidc_op.store.exceptions import DuplicateError + + +def test_duplicate_error_is_exception() -> None: + error = DuplicateError("user already exists") + assert isinstance(error, Exception) + assert str(error) == "user already exists"