mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 12:16:12 +00:00
fix exception logging where line of code is None
This commit is contained in:
parent
80a75113bd
commit
da3d2e014b
1 changed files with 14 additions and 10 deletions
|
@ -68,25 +68,29 @@ class GoogleAnalytics():
|
||||||
def formatException(self):
|
def formatException(self):
|
||||||
exc_type, exc_obj, exc_tb = sys.exc_info()
|
exc_type, exc_obj, exc_tb = sys.exc_info()
|
||||||
|
|
||||||
stackFrames = traceback.extract_tb(exc_tb)
|
latestStackFrame = None
|
||||||
if(len(stackFrames) > 0):
|
allStackFrames = traceback.extract_tb(exc_tb)
|
||||||
stackFrames = traceback.extract_tb(exc_tb)[-1]
|
if(len(allStackFrames) > 0):
|
||||||
else:
|
latestStackFrame = allStackFrames[-1]
|
||||||
stackFrames = None
|
log.error(str(latestStackFrame))
|
||||||
log.error(str(stackFrames))
|
|
||||||
|
|
||||||
errorType = "NA"
|
errorType = "NA"
|
||||||
errorFile = "NA"
|
errorFile = "NA"
|
||||||
|
|
||||||
if(stackFrames != None):
|
if(latestStackFrame != None):
|
||||||
fileName = os.path.split(stackFrames[0])[1]
|
fileName = os.path.split(latestStackFrame[0])[1]
|
||||||
|
|
||||||
errorFile = "%s:%s(%s)(%s)" % (fileName, stackFrames[1], exc_obj.message, stackFrames[3].strip())
|
codeLine = "NA"
|
||||||
|
if(len(latestStackFrame) > 3 and latestStackFrame[3] != None):
|
||||||
|
codeLine = latestStackFrame[3].strip()
|
||||||
|
|
||||||
|
errorFile = "%s:%s(%s)(%s)" % (fileName, latestStackFrame[1], exc_obj.message, codeLine)
|
||||||
errorFile = errorFile[0:499]
|
errorFile = errorFile[0:499]
|
||||||
errorType = "%s" % (exc_type.__name__)
|
errorType = "%s" % (exc_type.__name__)
|
||||||
del(exc_type, exc_obj, exc_tb)
|
|
||||||
log.error(errorType + " - " + errorFile)
|
log.error(errorType + " - " + errorFile)
|
||||||
|
|
||||||
|
del(exc_type, exc_obj, exc_tb)
|
||||||
|
|
||||||
return errorType, errorFile
|
return errorType, errorFile
|
||||||
|
|
||||||
def sendEventData(self, eventCategory, eventAction, eventLabel=None):
|
def sendEventData(self, eventCategory, eventAction, eventLabel=None):
|
||||||
|
|
Loading…
Reference in a new issue