Sindbad~EG File Manager
3
��go � @ s� d Z ddddgZddlZddlZddlZddlmZ ddlmZ dd lm Z dd
l
mZ ddlmZ ddl
mZ G d
d� dej�Zedd� �Zedd� �Zdd� ZdS )z>This module contains decorators for use with and without D-Bus�FirewallDBusException�handle_exceptions�dbus_handle_exceptions�dbus_service_method� N)�
DBusException)� decorator)�config)�
FirewallError)�errors)�logc @ s e Zd Zd Zdejj ZdS )r z%s.ExceptionN)�__name__�
__module__�__qualname__�__doc__r �dbusZDBUS_INTERFACEZ_dbus_error_name� r r � /usr/lib/python3.6/decorators.pyr + s c O sd y
| ||�S t k
rD } ztjtj� � tj|� W Y dd}~X n tk
r^ tj� Y nX dS )zTDecorator to handle exceptions and log them. Used if not conneced
to D-Bus.
N)r r �debug1� traceback�
format_exc�error� Exception� exception)�func�args�kwargsr r r r r / s
c O s� y
| ||�S t k
r� } zdt jt|��}|tjtjtjtjgkrRtj t|�� ntj
tj� � tj
t|�� tt|���W Y dd}~X nZ tk
r� } z
|�W Y dd}~X n6 tk
r� } ztj� tt|���W Y dd}~X nX dS )z�Decorator to handle exceptions, log and report them into D-Bus
:Raises DBusException: on a firewall error code problems.
N)r �get_code�strr
ZALREADY_ENABLEDZNOT_ENABLEDZZONE_ALREADY_SETZALREADY_SETr Zwarningr r r r r r r r )r r r r �codeZexr r r r <