
    f"                         d dl mZmZmZ d dlZd dlm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d Zy)    )divisionprint_functionunicode_literalsN)unicode_strc                   8    e Zd ZdZdZddZd Z ee      Zd Z	y)ChainableErrorz
    Base class for Onboard errors

    We want Python to print the stacktrace of the first exception in the chain
    so we store the last stacktrace if the previous exception in the chain
    has not.
    Nc                     || _         || _        |r7t        |t              r|j                  st        j                         | _        y y y N)_messagechained_exception
isinstancer   	tracebacksysexc_info_last_exception)selfmessager   s      4/usr/lib/python3/dist-packages/Onboard/Exceptions.py__init__zChainableError.__init__&   sB    !20.A)33 (+||~$ 4     c                     | j                   r| j                   d   S | j                  r0t        | j                  t              r| j                  j                  S y )N   )r   r   r   r   r   )r   s    r   _get_tracebackzChainableError._get_traceback2   sJ    ''**##t55~F))333r   c                 ~    t        | j                        }| j                  r|dt        | j                        z   z  }|S )Nz, )r   r   r   )r   r   s     r   __str__zChainableError.__str__=   s8    dmm,!!tk$*@*@AAAGr   r
   )
__name__
__module____qualname____doc__r   r   r   propertyr   r    r   r   r   r      s)     O	6 (Ir   r   c                       e Zd ZdZy)SVGSyntaxErrorz;Error raised when Onboard can't comprehend SVG layout file.Nr   r   r   r   r!   r   r   r#   r#   C   s    Er   r#   c                       e Zd ZdZy)LayoutFileErrorzBError raised when Onboard can't comprehend layout definition file.Nr$   r!   r   r   r&   r&   G   s    Lr   r&   c                       e Zd ZdZy)ThemeFileErrorzAError raised when Onboard can't comprehend theme definition file.Nr$   r!   r   r   r(   r(   K   s    Kr   r(   c                       e Zd ZdZy)ColorSchemeFileErrorzOError raised when Onboard can't comprehend color
       scheme definition file.Nr$   r!   r   r   r*   r*   O   s
    "r   r*   c                       e Zd ZdZy)SchemaErrorz5Error raised when a gesettings schema does not exist Nr$   r!   r   r   r,   r,   T   s    ?r   r,   c                     t        |t              r|j                  r|j                  }t        j                  | ||       y)z`
    Wrap the default handler so that we can get the traceback from chained
    exceptions.
    N)r   r   r   r   __excepthook__)typevaluer   s      r   chain_handlerr1   X   s/    
 %(U__OO	tUI.r   )
__future__r   r   r   r   Onboard.utilsr   	Exceptionr   r#   r&   r(   r*   r,   r1   r!   r   r   <module>r5      sb   , B A 
 %&Y &P	^ 		n 		^ 		> 	
	. 	/r   