error: Use more consistent details reporting

Always try and report summary + "\n\n" + details
This commit is contained in:
Cole Robinson 2011-04-06 11:52:26 -04:00
parent e0bc2563c7
commit f1c41b0866
10 changed files with 18 additions and 11 deletions

View File

@ -62,7 +62,7 @@ def _simple_async(callback, args, title, text, parent, errorintro,
error = errorintro + ": " + error
parent.err.show_err(error,
details=(error + "\n\n" + details))
details=details)
# Displays a progress bar while executing the "callback" method.
class vmmAsyncJob(vmmGObjectUI):

View File

@ -753,7 +753,7 @@ class vmmCloneVM(vmmGObjectUI):
error = (_("Error creating virtual machine clone '%s': %s") %
(self.clone_design.clone_name, error))
self.err.show_err(error,
details=(error + "\n" + details))
details=details)
else:
self.close()
self.conn.tick(noStatsUpdate=True)

View File

@ -1608,7 +1608,7 @@ class vmmCreate(vmmGObjectUI):
if error:
error = (_("Unable to complete install: '%s'") % error)
self.err.show_err(error,
details=(error + "\n" + details))
details=details)
self.failed_guest = self.guest
return

View File

@ -1119,7 +1119,7 @@ class vmmCreateInterface(vmmGObjectUI):
if error:
error = _("Error creating interface: '%s'") % error
self.err.show_err(error,
details=(error + "\n" + details))
details=details)
else:
# FIXME: Hmm, shouldn't we emit a signal here rather than do this?
self.conn.tick(noStatsUpdate=True)

View File

@ -402,7 +402,7 @@ class vmmCreatePool(vmmGObjectUI):
if error:
error = _("Error creating pool: %s") % error
self.err.show_err(error,
details=(error + "\n" + details))
details=details)
else:
self.close()

View File

@ -216,7 +216,7 @@ class vmmCreateVolume(vmmGObjectUI):
if error:
error = _("Error creating vol: %s") % error
self.show_err(error,
details=(error + "\n" + details))
details=details)
else:
self.emit("vol-created")
self.close()

View File

@ -822,7 +822,7 @@ class vmmEngine(vmmGObject):
if error is not None:
error = _("Error saving domain: %s") % error
src.err.show_err(error,
details=(error + "\n" + details))
details=details)
def _save_cancel(self, asyncjob, vm):
logging.debug("Cancelling save job")
@ -871,7 +871,7 @@ class vmmEngine(vmmGObject):
if error is not None:
error = _("Error restoring domain: %s") % error
src.err.show_err(error,
details=(error + "\n" + details))
details=details)
def _restore_saved_callback(self, asyncjob, file_to_load, conn):
ignore = asyncjob

View File

@ -67,7 +67,12 @@ class vmmErrorDialog (object):
logging.debug("dialog message: %s : %s" % (summary, details))
if details is None:
details = "".join(traceback.format_exc())
details = summary + "\n\n" + "".join(traceback.format_exc())
# Make sure we have consistent details for error dialogs
if (dialog_type == gtk.MESSAGE_ERROR and not
details.count(summary)):
details = summary + "\n\n" + details
dialog = _errorDialog(parent=self.get_parent(),
type=dialog_type, buttons=buttons)

View File

@ -462,7 +462,7 @@ class vmmMigrateDialog(vmmGObjectUI):
if error:
error = _("Unable to migrate guest: %s") % error
self.err.show_err(error,
details=(error + "\n" + details))
details=details)
else:
self.conn.tick(noStatsUpdate=True)
destconn.tick(noStatsUpdate=True)

View File

@ -310,6 +310,8 @@ class vmmStorageBrowser(vmmGObjectUI):
vol.get_format() or "", namestr])
def show_err(self, info, details=None):
self.err.show_err(info, details, async=False)
self.err.show_err(info,
details=details,
async=False)
vmmGObjectUI.type_register(vmmStorageBrowser)