From dc344989c6e05550206c34cbf66196aa9615e3ca Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Fri, 30 Sep 2016 09:39:14 +0200 Subject: [PATCH] revised missing userscript error messages --- qutebrowser/commands/userscripts.py | 11 +++++------ tests/end2end/features/spawn.feature | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/qutebrowser/commands/userscripts.py b/qutebrowser/commands/userscripts.py index 2d9fb1dd1..eb2de03ed 100644 --- a/qutebrowser/commands/userscripts.py +++ b/qutebrowser/commands/userscripts.py @@ -327,20 +327,19 @@ class NotFoundError(Error): Attributes: script_name: name of the userscript as called paths: path names that were searched for the userscript - message: descriptive message string of the error """ def __init__(self, script_name, paths=None): super().__init__() self.script_name = script_name self.paths = paths - self.message = "Userscript '" + script_name + "' not found" - if paths: - self.message += " in userscript directory '" + \ - ("' or '".join(paths)) + "'" 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): diff --git a/tests/end2end/features/spawn.feature b/tests/end2end/features/spawn.feature index 341e6c921..dc12f4078 100644 --- a/tests/end2end/features/spawn.feature +++ b/tests/end2end/features/spawn.feature @@ -10,7 +10,7 @@ Feature: :spawn Scenario: Starting a userscript which doesn't 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 When I run :spawn -u /this_does_not_exist