U
    M[^@                     @   sp   d dl mZ G dd deZG dd deZG dd deZG dd	 d	eZG d
d deZG dd deZdS )    )statusc                   @   s$   e Zd ZdZdZeddddZdS )UserFacingErrorz
    An exception to be raised when an execution-ending error is encountered.

    :param msg:
        Takes a single parameter, which is the user-facing error message that
        should be emitted before exiting non-zero.
       Nmsgreturnc                 C   s
   || _ d S N)r   selfr    r   5/usr/lib/python3/dist-packages/uaclient/exceptions.py__init__   s    zUserFacingError.__init__)__name__
__module____qualname____doc__	exit_codestrr   r   r   r   r   r      s   r   c                   @   s   e Zd ZdZdZdS )NonAutoAttachImageErrorz>Raised when machine isn't running an auto-attach enabled imager   N)r   r   r   r   r   r   r   r   r   r      s   r   c                       s$   e Zd ZdZdZ fddZ  ZS )AlreadyAttachedErrorzDAn exception to be raised when a command needs an unattached system.r   c                    s$   t  tjj|jd d d d S )Nr   name)Zaccount_name)superr   r   ZMESSAGE_ALREADY_ATTACHEDformatZaccounts)r
   Zcfg	__class__r   r   r      s
    zAlreadyAttachedError.__init__)r   r   r   r   r   r   __classcell__r   r   r   r   r      s   r   c                       s    e Zd ZdZ fddZ  ZS )MissingAptURLDirectivez@An exception for when the contract server doesn't include aptURLc                    s   t  tjj|d d S )N)entitlement_name)r   r   r   Z!MESSAGE_MISSING_APT_URL_DIRECTIVEr   )r
   r   r   r   r   r   )   s
    zMissingAptURLDirective.__init__r   r   r   r   r   r   r   r   r   r   r   &   s   r   c                       s&   e Zd ZdZdd fddZ  ZS )NonRootUserErrorz7An exception to be raised when a user needs to be root.N)r   c                    s   t  tj d S r   )r   r   r   ZMESSAGE_NONROOT_USER)r
   r   r   r   r   4   s    zNonRootUserError.__init__r   r   r   r   r   r   1   s   r   c                       s.   e Zd ZdZejfedd fddZ  ZS )UnattachedErrorz>An exception to be raised when a machine needs to be attached.Nr   c                    s   t  | d S r   )r   r   r	   r   r   r   r   ;   s    zUnattachedError.__init__)	r   r   r   r   r   ZMESSAGE_UNATTACHEDr   r   r   r   r   r   r   r    8   s   r    N)	Zuaclientr   	Exceptionr   r   r   r   r   r    r   r   r   r   <module>   s   