re thorw exception in wrapper

This commit is contained in:
shaun 2016-11-01 10:54:38 +11:00
parent 590c3ef4c3
commit 066ec81e16
3 changed files with 5 additions and 5 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.emby" <addon id="plugin.video.emby"
name="Emby" name="Emby"
version="2.3.2" version="2.3.3"
provider-name="Emby.media"> provider-name="Emby.media">
<requires> <requires>
<import addon="xbmc.python" version="2.19.0"/> <import addon="xbmc.python" version="2.19.0"/>

View file

@ -22,7 +22,7 @@ ga = GoogleAnalytics()
################################################################################################## ##################################################################################################
def catch_except(errors=(Exception, ), default_value=False): def catch_except(errors=(Exception, )):
# Will wrap method with try/except and print parameters for easier debugging # Will wrap method with try/except and print parameters for easier debugging
def decorator(func): def decorator(func):
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
@ -34,7 +34,7 @@ def catch_except(errors=(Exception, ), default_value=False):
log.exception(error) log.exception(error)
log.error("function: %s \n args: %s \n kwargs: %s", log.error("function: %s \n args: %s \n kwargs: %s",
func.__name__, args, kwargs) func.__name__, args, kwargs)
return default_value raise
return wrapper return wrapper
return decorator return decorator

View file

@ -307,7 +307,7 @@ def indent(elem, level=0):
if level and (not elem.tail or not elem.tail.strip()): if level and (not elem.tail or not elem.tail.strip()):
elem.tail = i elem.tail = i
def catch_except(errors=(Exception, ), default_value=False): def catch_except(errors=(Exception, )):
# Will wrap method with try/except and print parameters for easier debugging # Will wrap method with try/except and print parameters for easier debugging
def decorator(func): def decorator(func):
def wrapper(*args, **kwargs): def wrapper(*args, **kwargs):
@ -317,7 +317,7 @@ def catch_except(errors=(Exception, ), default_value=False):
log.exception(error) log.exception(error)
log.error("function: %s \n args: %s \n kwargs: %s", log.error("function: %s \n args: %s \n kwargs: %s",
func.__name__, args, kwargs) func.__name__, args, kwargs)
return default_value raise
return wrapper return wrapper
return decorator return decorator