U
    VÉc—  ã                   @   s$   d dl mZ d dlmZ dd„ ZdS )é    )ÚValidationError)Úexception_handlerc                 C   s^   t | |ƒ}t| tƒrZ|jD ]*}t|j| ƒtkr|j| d |j|< qdd|jdœ}||_|S )Nr   Zvalidation_errorzSome fields are not valid)ÚstatusÚmessageÚfields)r   Ú
isinstancer   ÚdataÚtypeÚlist)ÚexcÚcontextÚresponseÚitemÚmy_response© r   ú,/var/www/wikiazma_server/utils/exceptions.pyÚcustom_exception_handler   s    


r   N)Úrest_framework.exceptionsr   Úrest_framework.viewsr   r   r   r   r   r   Ú<module>   s   