File: //lib/python3/dist-packages/docker/__pycache__/errors.cpython-310.pyc
o
    �2.a&  �                   @   sT  d dl Z G dd� de�Zdd� ZG dd� de jje�ZG dd	� d	e�ZG d
d� de�ZG dd
� d
e�Z	G dd� de�Z
G dd� de�ZG dd� de�ZG dd� de�Z
G dd� de�ZG dd� dee�ZG dd� de�ZG dd� de�ZG dd� de�ZG d d!� d!e�Zd"d#� ZG d$d%� d%e�ZG d&d'� d'e�ZG d(d)� d)e�ZG d*d+� d+e�ZdS ),�    Nc                   @   s   e Zd ZdZdS )�DockerExceptionz�
    A base class from which all other exceptions inherit.
    If you want to catch all errors that the Docker SDK might raise,
    catch this base exception.
    N)�__name__�
__module__�__qualname__�__doc__� r   r   �//usr/lib/python3/dist-packages/docker/errors.pyr      s    r   c                 C   s�   | j }z|�� d }W n ty   |jpd�� }Y nw t}|jdkr<|r:dt|�v s7dt|�v s7dt|�v r:t}nt	}|| ||d��)zH
    Create a suitable APIError from requests.exceptions.HTTPError.
    �message� i�  z
No such imagez+not found: does not exist or no pull accesszrepository does not exist)�response�explanation)
r   �json�
ValueError�content�strip�APIError�status_code�str�
ImageNotFound�NotFound)�er   r   �clsr   r   r   �$create_api_error_from_http_exception
   s    �
�r   c                       sR   e Zd ZdZd� fdd�	Z� fdd�Zedd� �Zd	d
� Zdd� Z	d
d� Z
�  ZS )r   z%
    An HTTP error from the API.
    Nc                    s   t � �|� || _|| _d S �N)�super�__init__r   r   )�selfr	   r   r   ��	__class__r   r   r   &