[MixMaster] Display more useful error messages

Include the full text of the original exception, and print this to the terminal
as well.
This commit is contained in:
Ray Speth 2015-06-02 11:03:49 -04:00
parent a677409283
commit 835b81a6f8
3 changed files with 7 additions and 4 deletions

View file

@ -179,8 +179,8 @@ class EditFrame(Frame):
try:
self.redraw()
self.app.makeWindows()
except:
handleError('Edit err')
except Exception as e:
handleError('Edit err:\n'+str(e))
self.app.mix = IdealGasMixture(self.app.mech)
self.mix = self.app.mix

View file

@ -68,9 +68,9 @@ class MixMaster:
self.mech = Solution(pathname)
self.mechname = ff[0]
except:
except Exception as e:
utilities.handleError('could not create gas mixture object: '
+ff[0]+'\n')
+ff[0]+'\n'+str(e))
self.mechname = 'Error'
return

View file

@ -28,6 +28,9 @@ def _print_value(name, value, unitstr):
def handleError(message = '<error>', window = None,
fatal = 0, warning = 0, options = None):
# Print the message to the terminal, since this can at least be copied and
# pasted, unlike the contents of the dialog box.
print(message)
if warning:
messagebox.showwarning(title = 'Warning', message = message,
parent = window)