Exceptions and Redaction¶
Package exceptions expose stable code values for application-level handling.
Redaction helpers reduce accidental disclosure in logs and diagnostics, but they
do not replace careful data classification and access controls.
errors ¶
Typed Survey Scribe errors and safe redaction helpers.
SurveyScribeError ¶
Bases: Exception
Base class for stable public Survey Scribe errors.
ProgrammerInputError ¶
RunningEventLoopError ¶
ClientClosedError ¶
ConversionFailedError ¶
Bases: SurveyScribeError, RuntimeError
A compatibility entry point cannot return a failed result envelope.
ConfigurationError ¶
AmbiguousCredentialError ¶
ArtifactError ¶
ArtifactCollisionError ¶
ArtifactWriteError ¶
ArtifactWriteError(stage: str, message: str)
Bases: ArtifactError, OSError
A required artifact transaction stage failed.
redact_text ¶
redact_text(
value: str, *, sensitive_values: Sequence[str] = ()
) -> str
Redact recognized credentials and explicit sensitive values best-effort.
Arbitrary secret formats cannot be detected. Callers must provide known
values through sensitive_values and avoid recording raw request objects.
is_sensitive_key ¶
is_sensitive_key(value: str) -> bool
Return whether a field name denotes recognized sensitive content.
is_sensitive_query_key ¶
is_sensitive_query_key(value: str) -> bool
Return whether an exact URL query key carries credentials.
redact_exception ¶
redact_exception(
error: BaseException,
*,
sensitive_values: Sequence[str] = (),
) -> str
Render an exception chain without retaining nested sensitive values.
redact_data ¶
redact_data(
value: Any, *, sensitive_values: Sequence[str] = ()
) -> Any
Recursively redact mappings, sequences, strings, and exceptions.
Provider exceptions¶
base ¶
Provider-neutral structured generation port and safe normalized results.
ProviderError ¶
ProviderError()
ProviderDependencyError ¶
ProviderDependencyError(
extra: Literal["openai", "anthropic"] = "openai",
)
Bases: ProviderError, ImportError
The selected optional provider extra is unavailable.
ProviderCapabilityError ¶
ProviderCapabilityError(
reason: Literal[
"strict",
"schema",
"setting",
"output_limit",
"input_limit",
"drift",
] = "strict",
)
Bases: ProviderError, ValueError
A requested model, schema, limit, or setting is unsupported.
ProviderTransportError ¶
ProviderTransportError(*, retryable: bool)
Bases: ProviderError
A provider transport failed with normalized retryability.
ProviderAuthenticationError ¶
ProviderAuthenticationError()
Bases: ProviderTransportError
Provider credentials were rejected.
ProviderRateLimitError ¶
ProviderRateLimitError()
Bases: ProviderTransportError
The provider applied a retryable rate limit.
ProviderValidationError ¶
ProviderValidationError()
Bases: ProviderError, ValueError
All bounded structured-response validation attempts failed.
ProviderTruncationError ¶
ProviderTruncationError()
Bases: ProviderError
The provider reported an incomplete length-limited response.