class ErrorDialog(Gtk.MessageDialog): (source)
Known subclasses: zim.gui.pageview.SavePageErrorDialog
The is the main class for error dialogs in zim. It not only presents the error to the user, but also takes care of logging it. So the error dialog can be used as a generic catch all for exceptions in the user interface. The way the error is shown depends on the class of the exception:
For exceptions that inherit from zim.errors.Error
or EnvironmentError (e.g. OSError or IOError) a normal error dialog will be shown. This covers errors that can can occur in normal usage. As a special case the "filename" attribute of Environment errors is used and added to the error message.
On the other all exceptions that do not inherit from these classes (so all standard in exceptions like AssertionError, KeyError etc.) are considered the result of bugs and the dialog will say: "Looks like you found a bug" and show a stack trace.
Note | |
in menu action handlers you typically do not need to catch exceptions with an error dialog. The standard menu wrapper takes care of that. |
Method | __init__ |
Constructor |
Method | assert_response_ok |
Undocumented |
Method | do_response_ok |
Response handler for the 'OK' button @implementation: optional to be implemented by sub-classes that want to run some action after presenting the error. |
Method | get_debug_text |
Get the text to show in the log of a "You found a bug" dialog. Includes zim version info and traceback info. |
Method | run |
Runs the dialog and destroys it directly. |
Instance Variable | do_logging |
Undocumented |
Instance Variable | error |
Undocumented |
Instance Variable | showing_trace |
Undocumented |
Method | _run |
Undocumented |
zim.gui.pageview.SavePageErrorDialog
Parameters | |
parent | either a parent window or dialog or None |
error | the actual error, either an Exception object (including instances of zim.errors.Error ), a string with the error description, or a 2-tuple of the short message and the longer description as strings. Using a tuple here will give a better looking dialog over using a simple string. |
exc_info | this is an optional argument that takes the result of sys.exc_info(). This parameter is not necessary in most cases where the dialog is run while the exception is still in scope. One reason to pass it on explicitly is the handling of errors from an async operation in the main tread. |
do_logging | if True also log the error, if False assume someone else already did |
buttons | a constant controlling what kind of buttons the dialog will have. One of:
|
zim.gui.pageview.SavePageErrorDialog
Unknown Field: implementation | |
optional to be implemented by sub-classes that want to run some action after presenting the error. |
Parameters | |
exc_info | this is an optional argument that takes the result of sys.exc_info() |
Returns | |
debug log as string |