mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
Add silent catch for errors
This commit is contained in:
parent
66367001f3
commit
085e243e86
2 changed files with 16 additions and 0 deletions
|
@ -19,6 +19,7 @@ from utils import create_id
|
|||
|
||||
from wrapper import progress
|
||||
from wrapper import catch
|
||||
from wrapper import silent_catch
|
||||
from wrapper import stop
|
||||
from wrapper import emby_item
|
||||
from wrapper import library_check
|
||||
|
|
|
@ -61,6 +61,21 @@ def catch(errors=(Exception,)):
|
|||
return wrapper
|
||||
return decorator
|
||||
|
||||
def silent_catch(errors=(Exception,)):
|
||||
|
||||
''' Wrapper to catch exceptions and ignore them
|
||||
'''
|
||||
def decorator(func):
|
||||
def wrapper(*args, **kwargs):
|
||||
|
||||
try:
|
||||
return func(*args, **kwargs)
|
||||
except errors as error:
|
||||
LOG.error(error)
|
||||
|
||||
return wrapper
|
||||
return decorator
|
||||
|
||||
def stop(default=None):
|
||||
|
||||
''' Wrapper to catch exceptions and return using catch
|
||||
|
|
Loading…
Reference in a new issue