
    Uٵg                         d dl mZ d dlmZmZ d dlmZ d dlmZ d dl	m
Z
 dedefdZ G d	 d
e      Z G d de      Z G d de      Z G d de      Z G d de      Z G d de      Zy)    )messages)APIResponseErrorWarningObject)UbuntuProError)get_pro_environment)check_for_new_version	exceptionreturnc                    t        | t        t        f      rLt        | j                  | j
                  xs d| j                  j                  z   | j                  xs i       }n.t        t        |       d| j                  j                  z   i       }g }t               }|r]|j                  t        t        j                  j                  |      j                  t        j                  j                  i              t!        ddddt#        t%               j'                               D cg c]
  \  }}||d c}}ii|g|	      S c c}}w )
Nzgeneric-)titlecodemeta)versionv1failurer   environment_vars)namevalue)_schema_versionresultdataerrorswarnings)
isinstancer   APIErrorr   msgmsg_code	__class____name__additional_infostrr   appendr   WARN_NEW_VERSION_AVAILABLEformatr   r   sortedr   items)r	   errorr   new_versionr   r   s         5/usr/lib/python3/dist-packages/uaclient/api/errors.py	error_outr*      s;   )nh78"--## 9I//888**0b	
 #i.i11:::
 H')K99@@' A #88==	
 "'-.A.C.I.I.K'L%#e "E2%
 w 
%s   )Ec                       e Zd Zy)r   N)r   
__module____qualname__     r)   r   r   4   s    r/   r   c                   $    e Zd Zej                  Zy)APIInvalidEndpointN)r   r,   r-   r   E_API_INVALID_ENDPOINT_formatted_msgr.   r/   r)   r1   r1   8   s    44Nr/   r1   c                   $    e Zd Zej                  Zy)APIMissingArgN)r   r,   r-   r   E_API_MISSING_ARGr3   r.   r/   r)   r5   r5   <   s    //Nr/   r5   c                   $    e Zd Zej                  Zy)APINoArgsForEndpointN)r   r,   r-   r   E_API_NO_ARG_FOR_ENDPOINTr3   r.   r/   r)   r8   r8   @   s    77Nr/   r8   c                   $    e Zd Zej                  Zy)APIJSONDataFormatErrorN)r   r,   r-   r   E_API_JSON_DATA_FORMAT_ERRORr3   r.   r/   r)   r;   r;   D   s    ::Nr/   r;   c                   $    e Zd Zej                  Zy)APIBadArgsFormatN)r   r,   r-   r   E_API_BAD_ARGS_FORMATr3   r.   r/   r)   r>   r>   H   s    33Nr/   r>   N)uaclientr   uaclient.api.data_typesr   r   uaclient.exceptionsr   uaclient.utilr   uaclient.versionr   	Exceptionr*   r   r1   r5   r8   r;   r>   r.   r/   r)   <module>rF      sp     C . - 2) ){ )X	~ 	5 50H 088 8;X ;4x 4r/   