Errors¶
Exception classes raised by grpcvcr.
Overview¶
All grpcvcr exceptions inherit from GrpcvcrError, making it easy to catch any grpcvcr-specific error.
from grpcvcr import (
CassetteNotFoundError,
GrpcvcrError,
RecordingDisabledError,
RecordMode,
recorded_channel,
)
try:
with recorded_channel(
"missing.yaml", "localhost:50051", record_mode=RecordMode.NONE
) as channel:
...
except CassetteNotFoundError:
print("Cassette file not found")
except RecordingDisabledError:
print("No matching interaction and recording is disabled")
except GrpcvcrError:
print("Some other grpcvcr error")
API Reference¶
Bases: Exception
Base exception for all grpcvcr errors.
All grpcvcr exceptions inherit from this class, making it easy to catch any grpcvcr-specific error.
Bases: GrpcvcrError
Raised when a cassette file cannot be found.
This occurs when using RecordMode.NONE or RecordMode.ONCE (after
initial recording) and the cassette file doesn't exist.
Source code in src/grpcvcr/errors.py
Bases: GrpcvcrError
Raised when a cassette cannot be written to disk.
This can occur due to permission issues, disk full, or other I/O errors.
Source code in src/grpcvcr/errors.py
Bases: GrpcvcrError
Raised when no recorded interaction matches the request.
This typically means the test is making a new RPC call that wasn't recorded in the cassette.
Source code in src/grpcvcr/errors.py
Bases: GrpcvcrError
Raised when recording is attempted but disabled.
This occurs in RecordMode.NONE when a request is made that doesn't
match any recorded interaction.
Source code in src/grpcvcr/errors.py
Bases: GrpcvcrError
Raised when request/response serialization fails.
This can occur when parsing a malformed cassette file or when serializing data to save.