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."""