
    i                     z    d Z  G d de          Z G d de          Z G d de          Z G d de          Zd	S )
z pySim: Exceptions
c                       e Zd ZdZdS )NoCardErrorz No card was found in the reader.N__name__
__module____qualname____doc__     >/home/jenkins/workspace/simtester-sanitize/pySim/exceptions.pyr   r      s        ****r
   r   c                       e Zd ZdZdS )ProtocolErrorz<Some kind of protocol level error interfacing with the card.Nr   r	   r
   r   r   r      s        FFFFr
   r   c                       e Zd ZdZdS )ReaderErrorz0Some kind of general error with the card reader.Nr   r	   r
   r   r   r   !   s        ::::r
   r   c                   @    e Zd ZdZddedefdZed             Zd ZdS )	SwMatchErrorzgRaised when an operation specifies an expected SW but the actual SW from
       the card doesn't match.N	sw_actualsw_expectedc                 0    || _         || _        || _        dS )a  
        Args:
                sw_actual : the SW we actually received from the card (4 hex digits)
                sw_expected : the SW we expected to receive from the card (4 hex digits)
                rs : interpreter class to convert SW to string
        N)r   r   rs)selfr   r   r   s       r   __init__zSwMatchError.__init__)   s     #&r
   c                     | j         rQ| j         j        d         r?| j         j        d                             | j                  }|r|d         d|d         S dS )N    z -     )r   lchaninterpret_swr   )r   rs     r   descriptionzSwMatchError.description4   s`    7 	0tw}Q' 	0a --dn==A 0$%aDDD!A$$//rr
   c                 L    | j         }|rd|z   }nd}d| j        d| j        |S )Nz: .zSW match failed! Expected z	 and got )r   r   r   )r   r   s     r   __str__zSwMatchError.__str__<   sE    & 	,KKK>B>N>N>NPTP^P^`k`kllr
   )N)	r   r   r   r   strr   propertyr   r"   r	   r
   r   r   r   %   st        " "	 	# 	C 	 	 	 	   Xm m m m mr
   r   N)r   	Exceptionr   r   r   r   r	   r
   r   <module>r&      s    ,+ + + + +) + + +G G G G GI G G G; ; ; ; ;) ; ; ;m m m m m9 m m m m mr
   