Fix context managers swallowing exceptions
This commit is contained in:
parent
5305d7bdfd
commit
f835e84d80
5 changed files with 17 additions and 1 deletions
|
@ -70,6 +70,9 @@ class ItemBase(object):
|
||||||
"""
|
"""
|
||||||
Make sure DB changes are committed and connection to DB is closed.
|
Make sure DB changes are committed and connection to DB is closed.
|
||||||
"""
|
"""
|
||||||
|
if exc_type:
|
||||||
|
# re-raise any exception
|
||||||
|
return False
|
||||||
self.commit()
|
self.commit()
|
||||||
self.plexconn.close()
|
self.plexconn.close()
|
||||||
self.kodiconn.close()
|
self.kodiconn.close()
|
||||||
|
|
|
@ -27,6 +27,9 @@ class KodiDBBase(object):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(self, e_typ, e_val, trcbak):
|
def __exit__(self, e_typ, e_val, trcbak):
|
||||||
|
if e_typ:
|
||||||
|
# re-raise any exception
|
||||||
|
return False
|
||||||
self.kodiconn.commit()
|
self.kodiconn.commit()
|
||||||
self.kodiconn.close()
|
self.kodiconn.close()
|
||||||
if self._texture_db:
|
if self._texture_db:
|
||||||
|
|
|
@ -29,6 +29,9 @@ class PlexDBBase(object):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(self, e_typ, e_val, trcbak):
|
def __exit__(self, e_typ, e_val, trcbak):
|
||||||
|
if e_typ:
|
||||||
|
# re-raise any exception
|
||||||
|
return False
|
||||||
self.plexconn.commit()
|
self.plexconn.commit()
|
||||||
self.plexconn.close()
|
self.plexconn.close()
|
||||||
|
|
||||||
|
|
|
@ -667,7 +667,8 @@ class XmlKodiSetting(object):
|
||||||
|
|
||||||
def __exit__(self, e_typ, e_val, trcbak):
|
def __exit__(self, e_typ, e_val, trcbak):
|
||||||
if e_typ:
|
if e_typ:
|
||||||
raise
|
# re-raise any exception
|
||||||
|
return False
|
||||||
# Only safe to file if we did not botch anything
|
# Only safe to file if we did not botch anything
|
||||||
if self.write_xml is True:
|
if self.write_xml is True:
|
||||||
self._remove_empty_elements()
|
self._remove_empty_elements()
|
||||||
|
|
|
@ -986,6 +986,9 @@ class WindowProperty():
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, traceback):
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
if exc_type:
|
||||||
|
# re-raise any exception
|
||||||
|
return False
|
||||||
self.win.setProperty(self.prop, self.end or self.old)
|
self.win.setProperty(self.prop, self.end or self.old)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1003,4 +1006,7 @@ class GlobalProperty():
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def __exit__(self, exc_type, exc_value, traceback):
|
def __exit__(self, exc_type, exc_value, traceback):
|
||||||
|
if exc_type:
|
||||||
|
# re-raise any exception
|
||||||
|
return False
|
||||||
xbmcgui.Window(10000).setProperty('{0}.{1}'.format(self._addonID, self.prop), self.end or self.old)
|
xbmcgui.Window(10000).setProperty('{0}.{1}'.format(self._addonID, self.prop), self.end or self.old)
|
||||||
|
|
Loading…
Reference in a new issue