U
    *e
                     @   sL   d dl Z d dlZG dd deZG dd deZG dd deZdd	 ZdS )
    Nc                       s&   e Zd ZdZdd fdd
Z  ZS )UserExceptionz3 An exception capturing user friendly information. Ndetailc                   s   t    || _|| _dS )z_ Initialise the exception with its user friendly text and the
        optional detail.
        N)super__init__textr   )selfr   r   	__class__ 2lib/python3.8/site-packages/sipbuild/exceptions.pyr      s    
zUserException.__init____name__
__module____qualname____doc__r   __classcell__r   r   r	   r   r      s   r   c                       s&   e Zd ZdZdd fdd
Z  ZS )UserFileExceptionz* An exception related to a specific file. Nr   c                   s   t  jd|||d dS ) Initialise the exception. {0}: {1}r   N)r   r   format)r   filenamer   r   r	   r   r   r   -   s    zUserFileException.__init__r   r   r   r	   r   r   *   s   r   c                       s&   e Zd ZdZdd fdd
Z  ZS )UserParseExceptionz9 An exception related to the parsing of a specific file. Nr   c                   s   t  j|d|d dS )r   zunable to parse filer   N)r   r   )r   r   r   r	   r   r   r   6   s    zUserParseException.__init__r   r   r   r	   r   r   3   s   r   c                 C   s   t | trZ| jdk	r&d| j| j}n| j}tdtjt	j
d |t	jd t	d tdtjt	j
d t	jd | dS )z# Tell the user about an exception. Nr   r   )file   z"{0}: An internal error occurred...)
isinstancer   r   r   r   printospathbasenamesysargvstderrexit)emessager   r   r   handle_exception<   s    


r&   )r   r    	Exceptionr   r   r   r&   r   r   r   r   <module>   s
   		