Overview
The exceptions module defines custom exception classes for handling various error conditions when working with Kubernetes and OpenShift resources.MissingRequiredArgumentError
Raised when a required argument is not provided to a resource constructor.Attributes
str
The name of the missing required argument.
MissingResourceError
Raised when a resource fails to generate or cannot be created from provided parameters.Attributes
str
The name of the resource that failed to generate.
MissingResourceResError
Legacy exception for missing resource generation. UseMissingResourceError for new code.
MissingTemplateVariables
Raised when required template variables are not provided for resource templating.Attributes
str
The name of the missing variable.
str
The name or path of the template requiring the variable.
ExecOnPodError
Raised when a command execution fails inside a pod.Attributes
list[str]
The command that was executed and failed.
int
The return code from the failed command.
str
Standard output from the command.
Any
Standard error output or error details from the command.
ValidationError
Raised when resource validation against the OpenAPI schema fails.Attributes
str
Human-readable error message describing the validation failure.
str
JSONPath to the invalid field (e.g., “spec.containers[0].image”).
Any
Original jsonschema validation error object for debugging.
Example with Path Information
ConditionError
Raised when a resource condition reaches an unexpected state during waiting operations.Usage Context
This exception is typically raised by:wait_for_condition()when a stop condition is met- Condition monitoring operations that detect failure states
- Resource readiness checks that encounter error conditions
ResourceTeardownError
Raised when a resource fails to be deleted or torn down properly.Attributes
Any
The resource object that failed to be torn down.
Context Manager Usage
ClientWithBasicAuthError
Raised when client creation or authentication fails using basic authentication.Common Causes
- Missing OAuth authorization server configuration
- Invalid credentials
- Failed token exchange
- Network connectivity issues
- Incorrect cluster endpoint URL
NNCPConfigurationFailed
Raised when Node Network Configuration Policy (NNCP) configuration fails.Usage
This exception is specific to OpenShift network configuration operations and is typically raised when:- Network policies fail to apply
- Node network configuration is invalid
- Network attachment definitions are misconfigured
Exception Hierarchy
All custom exceptions inherit from Python’s baseException class: