U
    ð¤ùd±  ã                   @   sh   d dl Z d dlmZ ddlmZ dZejdfdd„ZG dd	„ d	eƒZ	G d
d„ de	ƒZ
G dd„ de	ƒZdS )é    N)ÚHTTPExceptioné   )Ú
HTTPStatus)ÚabortÚ	RestErrorÚValidationErrorÚ
SpecsErrorc              
   K   sR   zt  | ¡ W n> tk
rL } z |r0t|ƒ|d< |r:||_‚ W 5 d}~X Y nX dS )aw  
    Properly abort the current request.

    Raise a `HTTPException` for the given status `code`.
    Attach any keyword arguments to the exception for later processing.

    :param int code: The associated HTTP status code
    :param str message: An optional details message
    :param kwargs: Any additional data to pass to the error payload
    :raise HTTPException:
    ÚmessageN)Úflaskr   r   ÚstrÚdata)Úcoder	   ÚkwargsÚe© r   ú6/tmp/pip-unpacked-wheel-dt_sn2ih/flask_restx/errors.pyr      s    r   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )r   z%Base class for all Flask-RESTX Errorsc                 C   s
   || _ d S ©N©Úmsg)Úselfr   r   r   r   Ú__init__(   s    zRestError.__init__c                 C   s   | j S r   r   )r   r   r   r   Ú__str__+   s    zRestError.__str__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   %   s   r   c                   @   s   e Zd ZdZdS )r   z%A helper class for validation errors.N©r   r   r   r   r   r   r   r   r   /   s   r   c                   @   s   e Zd ZdZdS )r   z-A helper class for incoherent specifications.Nr   r   r   r   r   r   5   s   r   )r
   Zwerkzeug.exceptionsr   Z_httpr   Ú__all__ÚINTERNAL_SERVER_ERRORr   Ú	Exceptionr   r   r   r   r   r   r   Ú<module>   s   
