异常

Podman API 错误。

exception APIError(message: str, response: Response | APIResponse | None = None, explanation: str | None = None)[source]

基类:HTTPError

封装 HTTP 错误,供 API 和客户端处理。

初始化 APIError。

参数:
  • message – 服务消息。默认值:response.text,可能通过绑定进行增强或封装

  • response – 来自服务的 HTTP 响应。

  • explanation – 带有附加上下文的消息的增强或封装版本。

add_note()

Exception.add_note(note) – 为异常添加备注

is_client_error() bool[source]

请求不正确时返回 True。

is_error() bool[source]

HTTP 操作导致错误时返回 True。

is_server_error() bool[source]

服务中发生错误时返回 True。

with_traceback()

Exception.with_traceback(tb) – 将 self.__traceback__ 设置为 tb 并返回 self。

args
characters_written
errno

POSIX 异常代码

filename

异常文件名

filename2

第二个异常文件名

property status_code

来自响应的 HTTP 状态码。

类型:

Optional[int]

strerror

异常错误信息

exception BuildError(reason: str, build_log: Iterable[str])[source]

基类:PodmanError

构建操作期间发生错误。

初始化 BuildError。

参数:
  • reason – 描述错误

  • build_log – 构建日志输出

add_note()

Exception.add_note(note) – 为异常添加备注

with_traceback()

Exception.with_traceback(tb) – 将 self.__traceback__ 设置为 tb 并返回 self。

args
exception ContainerError(container: Container, exit_status: int, command: str | list[str], image: str, stderr: Iterable[str] | None = None)[source]

基类:PodmanError

表示容器以非零退出代码退出。

初始化 ContainerError。

参数:
  • container – 报告错误的容器。

  • exit_status – 容器退出时的非零状态码。

  • command – 创建容器时传递给容器的命令。

  • image – 用于创建容器的镜像名称。

  • stderr – 容器报告的错误。

add_note()

Exception.add_note(note) – 为异常添加备注

with_traceback()

Exception.with_traceback(tb) – 将 self.__traceback__ 设置为 tb 并返回 self。

args
exception ImageNotFound(message: str, response: Response | APIResponse | None = None, explanation: str | None = None)[source]

基类:APIError

在 Podman 服务上找不到镜像。

初始化 APIError。

参数:
  • message – 服务消息。默认值:response.text,可能通过绑定进行增强或封装

  • response – 来自服务的 HTTP 响应。

  • explanation – 带有附加上下文的消息的增强或封装版本。

add_note()

Exception.add_note(note) – 为异常添加备注

is_client_error() bool

请求不正确时返回 True。

is_error() bool

HTTP 操作导致错误时返回 True。

is_server_error() bool

服务中发生错误时返回 True。

with_traceback()

Exception.with_traceback(tb) – 将 self.__traceback__ 设置为 tb 并返回 self。

args
characters_written
errno

POSIX 异常代码

filename

异常文件名

filename2

第二个异常文件名

property status_code

来自响应的 HTTP 状态码。

类型:

Optional[int]

strerror

异常错误信息

exception InvalidArgument[source]

基类:PodmanError

方法/函数的参数无效。

add_note()

Exception.add_note(note) – 为异常添加备注

with_traceback()

Exception.with_traceback(tb) – 将 self.__traceback__ 设置为 tb 并返回 self。

args
exception NotFound(message: str, response: Response | APIResponse | None = None, explanation: str | None = None)[source]

基类:APIError

在 Podman 服务上找不到资源。

为了兼容性而命名。

初始化 APIError。

参数:
  • message – 服务消息。默认值:response.text,可能通过绑定进行增强或封装

  • response – 来自服务的 HTTP 响应。

  • explanation – 带有附加上下文的消息的增强或封装版本。

add_note()

Exception.add_note(note) – 为异常添加备注

is_client_error() bool

请求不正确时返回 True。

is_error() bool

HTTP 操作导致错误时返回 True。

is_server_error() bool

服务中发生错误时返回 True。

with_traceback()

Exception.with_traceback(tb) – 将 self.__traceback__ 设置为 tb 并返回 self。

args
characters_written
errno

POSIX 异常代码

filename

异常文件名

filename2

第二个异常文件名

property status_code

来自响应的 HTTP 状态码。

类型:

Optional[int]

strerror

异常错误信息

exception PodmanError[source]

基类:DockerException

PodmanPy 异常的基类。

add_note()

Exception.add_note(note) – 为异常添加备注

with_traceback()

Exception.with_traceback(tb) – 将 self.__traceback__ 设置为 tb 并返回 self。

args
exception StreamParseError(reason)[source]

基类:RuntimeError

add_note()

Exception.add_note(note) – 为异常添加备注

with_traceback()

Exception.with_traceback(tb) – 将 self.__traceback__ 设置为 tb 并返回 self。

args