common base for userscript exceptions

This commit is contained in:
Daniel Karbach 2016-09-30 09:26:43 +02:00
parent cbbfbabfc4
commit eaa754648d
2 changed files with 8 additions and 3 deletions

View File

@ -1122,7 +1122,7 @@ class CommandDispatcher:
try: try:
userscripts.run_async(tab, cmd, *args, win_id=self._win_id, userscripts.run_async(tab, cmd, *args, win_id=self._win_id,
env=env, verbose=verbose) env=env, verbose=verbose)
except (userscripts.UnsupportedError, userscripts.NotFoundError) as e: except userscripts.Error as e:
raise cmdexc.CommandError(e) raise cmdexc.CommandError(e)
@cmdutils.register(instance='command-dispatcher', scope='window') @cmdutils.register(instance='command-dispatcher', scope='window')

View File

@ -315,7 +315,12 @@ class _WindowsUserscriptRunner(_BaseUserscriptRunner):
return return
class NotFoundError(Exception): class Error(Exception):
"""Base class for userscript exceptions."""
class NotFoundError(Error):
"""Raised when spawning a userscript that doesn't exist. """Raised when spawning a userscript that doesn't exist.
@ -338,7 +343,7 @@ class NotFoundError(Exception):
return self.message return self.message
class UnsupportedError(Exception): class UnsupportedError(Error):
"""Raised when userscripts aren't supported on this platform.""" """Raised when userscripts aren't supported on this platform."""