mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-05-05 00:48:47 +00:00
add throttling to error metric logging
add back in consumption of exception in function wrapper
This commit is contained in:
parent
817ad63007
commit
d7728afea0
4 changed files with 22 additions and 5 deletions
|
@ -22,7 +22,7 @@ ga = GoogleAnalytics()
|
|||
|
||||
##################################################################################################
|
||||
|
||||
def catch_except(errors=(Exception, )):
|
||||
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):
|
||||
|
@ -30,11 +30,11 @@ def catch_except(errors=(Exception, )):
|
|||
return func(*args, **kwargs)
|
||||
except errors as error:
|
||||
errStrings = ga.formatException()
|
||||
ga.sendEventData("Exception", errStrings[0], errStrings[1])
|
||||
ga.sendEventData("Exception", errStrings[0], errStrings[1], True)
|
||||
log.exception(error)
|
||||
log.error("function: %s \n args: %s \n kwargs: %s",
|
||||
func.__name__, args, kwargs)
|
||||
raise
|
||||
return default_value
|
||||
|
||||
return wrapper
|
||||
return decorator
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue