Fixed exception catching and logging.

This commit is contained in:
Tomas Groth 2014-06-22 21:51:19 +02:00
parent f74413ebe0
commit a3f15f1e82

View File

@ -228,7 +228,7 @@ class PowerpointDocument(PresentationDocument):
self.presentation.SlideShowWindow.View.GotoSlide(slide) self.presentation.SlideShowWindow.View.GotoSlide(slide)
if click: if click:
self.presentation.SlideShowWindow.View.GotoClick(click) self.presentation.SlideShowWindow.View.GotoClick(click)
except pywintypes.com_error: except pywintypes.com_error as e:
log.error(u'COM error while in unblank_screen') log.error(u'COM error while in unblank_screen')
log.error(e) log.error(e)
self.show_error_msg() self.show_error_msg()
@ -240,7 +240,7 @@ class PowerpointDocument(PresentationDocument):
log.debug(u'blank_screen') log.debug(u'blank_screen')
try: try:
self.presentation.SlideShowWindow.View.State = 3 self.presentation.SlideShowWindow.View.State = 3
except pywintypes.com_error: except pywintypes.com_error as e:
log.error(u'COM error while in blank_screen') log.error(u'COM error while in blank_screen')
log.error(e) log.error(e)
self.show_error_msg() self.show_error_msg()
@ -253,7 +253,7 @@ class PowerpointDocument(PresentationDocument):
if self.is_active(): if self.is_active():
try: try:
return self.presentation.SlideShowWindow.View.State == 3 return self.presentation.SlideShowWindow.View.State == 3
except pywintypes.com_error: except pywintypes.com_error as e:
log.error(u'COM error while in is_blank') log.error(u'COM error while in is_blank')
log.error(e) log.error(e)
return False return False
@ -267,7 +267,7 @@ class PowerpointDocument(PresentationDocument):
log.debug(u'stop_presentation') log.debug(u'stop_presentation')
try: try:
self.presentation.SlideShowWindow.View.Exit() self.presentation.SlideShowWindow.View.Exit()
except pywintypes.com_error: except pywintypes.com_error as e:
log.error(u'COM error while in stop_presentation') log.error(u'COM error while in stop_presentation')
log.error(e) log.error(e)
@ -313,7 +313,7 @@ class PowerpointDocument(PresentationDocument):
log.debug(u'get_slide_number') log.debug(u'get_slide_number')
try: try:
ret = self.presentation.SlideShowWindow.View.CurrentShowPosition ret = self.presentation.SlideShowWindow.View.CurrentShowPosition
except pywintypes.com_error: except pywintypes.com_error as e:
ret = 0 ret = 0
log.error(u'COM error while in get_slide_number') log.error(u'COM error while in get_slide_number')
log.error(e) log.error(e)
@ -327,7 +327,7 @@ class PowerpointDocument(PresentationDocument):
log.debug(u'get_slide_count') log.debug(u'get_slide_count')
try: try:
ret = self.presentation.Slides.Count ret = self.presentation.Slides.Count
except pywintypes.com_error: except pywintypes.com_error as e:
ret = 0 ret = 0
log.error(u'COM error while in get_slide_count') log.error(u'COM error while in get_slide_count')
log.error(e) log.error(e)
@ -341,7 +341,7 @@ class PowerpointDocument(PresentationDocument):
log.debug(u'goto_slide') log.debug(u'goto_slide')
try: try:
self.presentation.SlideShowWindow.View.GotoSlide(slideno) self.presentation.SlideShowWindow.View.GotoSlide(slideno)
except pywintypes.com_error: except pywintypes.com_error as e:
log.error(u'COM error while in goto_slide') log.error(u'COM error while in goto_slide')
log.error(e) log.error(e)
self.show_error_msg() self.show_error_msg()
@ -353,7 +353,7 @@ class PowerpointDocument(PresentationDocument):
log.debug(u'next_step') log.debug(u'next_step')
try: try:
self.presentation.SlideShowWindow.View.Next() self.presentation.SlideShowWindow.View.Next()
except pywintypes.com_error: except pywintypes.com_error as e:
log.error(u'COM error while in next_step') log.error(u'COM error while in next_step')
log.error(e) log.error(e)
self.show_error_msg() self.show_error_msg()