From eaa754648d6fdb458614e1518ee7616475ef5b65 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Fri, 30 Sep 2016 09:26:43 +0200 Subject: [PATCH] common base for userscript exceptions --- qutebrowser/browser/commands.py | 2 +- qutebrowser/commands/userscripts.py | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/qutebrowser/browser/commands.py b/qutebrowser/browser/commands.py index a06fc9361..4be7ed583 100644 --- a/qutebrowser/browser/commands.py +++ b/qutebrowser/browser/commands.py @@ -1122,7 +1122,7 @@ class CommandDispatcher: try: userscripts.run_async(tab, cmd, *args, win_id=self._win_id, env=env, verbose=verbose) - except (userscripts.UnsupportedError, userscripts.NotFoundError) as e: + except userscripts.Error as e: raise cmdexc.CommandError(e) @cmdutils.register(instance='command-dispatcher', scope='window') diff --git a/qutebrowser/commands/userscripts.py b/qutebrowser/commands/userscripts.py index 34898ad52..2d9fb1dd1 100644 --- a/qutebrowser/commands/userscripts.py +++ b/qutebrowser/commands/userscripts.py @@ -315,7 +315,12 @@ class _WindowsUserscriptRunner(_BaseUserscriptRunner): return -class NotFoundError(Exception): +class Error(Exception): + + """Base class for userscript exceptions.""" + + +class NotFoundError(Error): """Raised when spawning a userscript that doesn't exist. @@ -338,7 +343,7 @@ class NotFoundError(Exception): return self.message -class UnsupportedError(Exception): +class UnsupportedError(Error): """Raised when userscripts aren't supported on this platform."""