revised missing userscript error messages
This commit is contained in:
parent
eaa754648d
commit
dc344989c6
@ -327,20 +327,19 @@ class NotFoundError(Error):
|
|||||||
Attributes:
|
Attributes:
|
||||||
script_name: name of the userscript as called
|
script_name: name of the userscript as called
|
||||||
paths: path names that were searched for the userscript
|
paths: path names that were searched for the userscript
|
||||||
message: descriptive message string of the error
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, script_name, paths=None):
|
def __init__(self, script_name, paths=None):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.script_name = script_name
|
self.script_name = script_name
|
||||||
self.paths = paths
|
self.paths = paths
|
||||||
self.message = "Userscript '" + script_name + "' not found"
|
|
||||||
if paths:
|
|
||||||
self.message += " in userscript directory '" + \
|
|
||||||
("' or '".join(paths)) + "'"
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.message
|
msg = "Userscript '{}' not found".format(self.script_name)
|
||||||
|
if self.paths:
|
||||||
|
msg += " in userscript directories {}".format(
|
||||||
|
', '.join(repr(path) for path in self.paths))
|
||||||
|
return msg
|
||||||
|
|
||||||
|
|
||||||
class UnsupportedError(Error):
|
class UnsupportedError(Error):
|
||||||
|
@ -10,7 +10,7 @@ Feature: :spawn
|
|||||||
|
|
||||||
Scenario: Starting a userscript which doesn't exist
|
Scenario: Starting a userscript which doesn't exist
|
||||||
When I run :spawn -u this_does_not_exist
|
When I run :spawn -u this_does_not_exist
|
||||||
Then regex "Userscript 'this_does_not_exist' not found in userscript directory '(.*)'( or '(.*)')*" should be logged
|
Then the error "Userscript 'this_does_not_exist' not found in userscript directories *" should be shown
|
||||||
|
|
||||||
Scenario: Starting a userscript with absoloute path which doesn't exist
|
Scenario: Starting a userscript with absoloute path which doesn't exist
|
||||||
When I run :spawn -u /this_does_not_exist
|
When I run :spawn -u /this_does_not_exist
|
||||||
|
Loading…
Reference in New Issue
Block a user