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:
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')

View File

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