mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
Move catch except to _common.py
This commit is contained in:
parent
3630f52c07
commit
090ff79e8f
5 changed files with 23 additions and 8 deletions
|
@ -20,6 +20,21 @@ log = logging.getLogger("EMBY."+__name__)
|
||||||
|
|
||||||
##################################################################################################
|
##################################################################################################
|
||||||
|
|
||||||
|
def catch_except(errors=(Exception, ), default_value=False):
|
||||||
|
# Will wrap method with try/except and print parameters for easier debugging
|
||||||
|
def decorator(func):
|
||||||
|
def wrapper(*args, **kwargs):
|
||||||
|
try:
|
||||||
|
return func(*args, **kwargs)
|
||||||
|
except errors as error:
|
||||||
|
log.exception(error)
|
||||||
|
log.error("function: %s \n args: %s \n kwargs: %s",
|
||||||
|
func.__name__, args, kwargs)
|
||||||
|
return default_value
|
||||||
|
|
||||||
|
return wrapper
|
||||||
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
class Items(object):
|
class Items(object):
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ import urllib
|
||||||
import api
|
import api
|
||||||
import embydb_functions as embydb
|
import embydb_functions as embydb
|
||||||
import _kodi_movies
|
import _kodi_movies
|
||||||
from _common import Items
|
from _common import Items, catch_except
|
||||||
from utils import window, settings, language as lang, catch_except
|
from utils import window, settings, language as lang
|
||||||
|
|
||||||
##################################################################################################
|
##################################################################################################
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ import api
|
||||||
import embydb_functions as embydb
|
import embydb_functions as embydb
|
||||||
import musicutils
|
import musicutils
|
||||||
import _kodi_music
|
import _kodi_music
|
||||||
from _common import Items
|
from _common import Items, catch_except
|
||||||
from utils import window, settings, language as lang, catch_except
|
from utils import window, settings, language as lang
|
||||||
|
|
||||||
##################################################################################################
|
##################################################################################################
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,8 @@ import urllib
|
||||||
import api
|
import api
|
||||||
import embydb_functions as embydb
|
import embydb_functions as embydb
|
||||||
import _kodi_musicvideos
|
import _kodi_musicvideos
|
||||||
from _common import Items
|
from _common import Items, catch_except
|
||||||
from utils import window, settings, language as lang, catch_except
|
from utils import window, settings, language as lang
|
||||||
|
|
||||||
##################################################################################################
|
##################################################################################################
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ from ntpath import dirname
|
||||||
import api
|
import api
|
||||||
import embydb_functions as embydb
|
import embydb_functions as embydb
|
||||||
import _kodi_tvshows
|
import _kodi_tvshows
|
||||||
from _common import Items
|
from _common import Items, catch_except
|
||||||
from utils import window, settings, language as lang, catch_except
|
from utils import window, settings, language as lang
|
||||||
|
|
||||||
##################################################################################################
|
##################################################################################################
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue