ds_common_placeholder_py_lib.errors¶
File: errors.py
Region: ds-common-placeholder-py-lib
Description¶
Typed errors. A message names the placeholder text and the JSON path, never a resolved value, so it is safe to put in events and logs.
Exceptions¶
A placeholder could not be validated or resolved. |
|
Raised by a provider when a path has no value. |
Classes¶
Stable error codes. Callers map them to failure events. |
Module Contents¶
- class ds_common_placeholder_py_lib.errors.ErrorCode[source]¶
Bases:
enum.StrEnumStable error codes. Callers map them to failure events.
- SYNTAX = 'syntax'¶
- UNKNOWN_NAMESPACE = 'unknown_namespace'¶
- UNKNOWN_FUNCTION = 'unknown_function'¶
- ARITY = 'arity'¶
- ARGUMENT = 'argument'¶
- MISSING_VALUE = 'missing_value'¶
- TYPE = 'type'¶
- SECRET_SCOPE = 'secret_scope'¶
- SECRET_MISSING = 'secret_missing'¶
- SECRET_UNAVAILABLE = 'secret_unavailable'¶
- SQL_POSITION = 'sql_position'¶
- SQL_SECRET = 'sql_secret'¶
- PROTECTED_FIELD = 'protected_field'¶
- CYCLE = 'cycle'¶
- exception ds_common_placeholder_py_lib.errors.PlaceholderError(code: ErrorCode, message: str, *, path: str = '', placeholder: str | None = None, reference: str | None = None, namespaces: frozenset[str] = frozenset())[source]¶
Bases:
ExceptionA placeholder could not be validated or resolved.
- Parameters:
code – The error code.
message – What went wrong. Must not contain resolved values.
path – JSON Pointer of the string that holds the placeholder.
placeholder – The placeholder text as written in the definition. For a
syntaxerror it is input text that may be sensitive (an unclosed@{runs to the end of the string): it is cut to 64 characters, andstr()andrepr()leave it out.reference – The reference whose value caused the error, as written (
owner.settings.region; a whole namespace is its name), when one reference is at fault: its value is missing,nullor blank, of the wrong type, or the namespace is not there.Nonewhen the error is not one reference’s (a function’s own check, a vault read, everycoalesceargument missing).namespaces – The namespaces the part that failed reads: the reference at fault, or the innermost call that failed with everything nested in it, plus the namespace of reference. Empty for an error found before anything is read (
syntax,lookup’s own arguments, a SQL position, a secret call in SQL), and fromvalidate.
- code¶
- message¶
- path = ''¶
- property placeholder: str | None¶
The placeholder text; at most 64 characters for
syntax.
- reference = None¶
- namespaces¶