From 10929c3a67b07e8ef36bf1a2d6b7349279960d33 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Wed, 8 Aug 2012 07:10:59 +0100 Subject: [PATCH] Improved GUI display of AssertionErrors Before, the error box would typically be blank, or give no clue it was an error. --- zeroinstall/0launch-gui/mainwindow.py | 4 ++++ zeroinstall/injector/solver.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/zeroinstall/0launch-gui/mainwindow.py b/zeroinstall/0launch-gui/mainwindow.py index f796847..da857eb 100644 --- a/zeroinstall/0launch-gui/mainwindow.py +++ b/zeroinstall/0launch-gui/mainwindow.py @@ -208,6 +208,10 @@ class MainWindow: def report_exception(self, ex, tb = None): if not isinstance(ex, SafeException): + if isinstance(ex, AssertionError): + # Assertions often don't say that they're errors (and are frequently + # blank). + ex = repr(ex) if tb is None: warn(ex, exc_info = True) else: diff --git a/zeroinstall/injector/solver.py b/zeroinstall/injector/solver.py index 2bd0378..1f1a8b8 100644 --- a/zeroinstall/injector/solver.py +++ b/zeroinstall/injector/solver.py @@ -463,7 +463,7 @@ class SATSolver(Solver): filtered_impls.append(impl) - assert impl not in impl_to_var + assert impl not in impl_to_var, impl v = problem.add_variable(ImplInfo(iface, impl, arch)) impl_to_var[impl] = v var_names.append(v) -- 2.11.4.GIT