Removed redundant _action_wrapper decorator

This commit is contained in:
Fabio Manganiello 2022-08-05 19:00:48 +02:00
parent cbe2e7bbfe
commit 7ab02e705d
Signed by: blacklight
GPG Key ID: D90FBA7F76362774
1 changed files with 0 additions and 21 deletions

View File

@ -8,8 +8,6 @@ import re
from aiohttp import ClientConnectionError, ServerDisconnectedError
from dataclasses import dataclass
from functools import wraps
from typing import Callable
from async_lru import alru_cache
from nio import (
@ -61,7 +59,6 @@ from platypush.message.event.matrix import (
MatrixStickerEvent,
)
from platypush.message.response import Response
from platypush.plugins import RunnablePlugin, action
from platypush.schemas.matrix import (
MatrixDeviceSchema,
@ -90,18 +87,6 @@ class Credentials:
}
def _action_wrapper(f: Callable) -> Callable:
@wraps(f)
def _wrapper(*args, **kwargs):
try:
return f(*args, **kwargs)
except Exception as e:
logger.exception(e)
return Response(errors=[str(e)])
return _wrapper
class MatrixClient(AsyncClient):
def __init__(
self,
@ -576,7 +561,6 @@ class MatrixPlugin(RunnablePlugin):
self._connect()
@action
@_action_wrapper
def send_message(
self,
room_id: str,
@ -610,7 +594,6 @@ class MatrixPlugin(RunnablePlugin):
)
@action
@_action_wrapper
def get_profile(self, user_id: str):
"""
Retrieve the details about a user.
@ -623,7 +606,6 @@ class MatrixPlugin(RunnablePlugin):
return MatrixProfileSchema().dump(profile)
@action
@_action_wrapper
def get_room(self, room_id: str):
"""
Retrieve the details about a room.
@ -654,7 +636,6 @@ class MatrixPlugin(RunnablePlugin):
return MatrixRoomSchema().dump(room)
@action
@_action_wrapper
def get_devices(self):
"""
Get the list of devices associated to the current user.
@ -666,7 +647,6 @@ class MatrixPlugin(RunnablePlugin):
return MatrixDeviceSchema().dump(response.devices, many=True)
@action
@_action_wrapper
def get_joined_rooms(self):
"""
Retrieve the rooms that the user has joined.
@ -677,7 +657,6 @@ class MatrixPlugin(RunnablePlugin):
return [self.get_room(room_id).output for room_id in response.rooms]
@action
@_action_wrapper
def upload_keys(self):
"""
Synchronize the E2EE keys with the homeserver.