Standardise "Failed to load results" errors!
This commit is contained in:
parent
90c730979a
commit
8ea6db9422
19 changed files with 23 additions and 20 deletions
|
@ -22,4 +22,4 @@ class Module(ModuleManager.BaseModule):
|
|||
event["stderr"].write("Unknown currency, available "
|
||||
"currencies: %s" % ", ".join(page.keys()))
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
|
|
|
@ -34,7 +34,7 @@ class Module(ModuleManager.BaseModule):
|
|||
else:
|
||||
event["stderr"].write("Unable to find book")
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
|
||||
@utils.hook("received.command.isbn", min_args=1)
|
||||
def isbn(self, event):
|
||||
|
|
|
@ -39,7 +39,7 @@ class Module(ModuleManager.BaseModule):
|
|||
else:
|
||||
event["stderr"].write("No definitions found")
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
|
||||
@utils.hook("received.command.randomword")
|
||||
def random_word(self, event):
|
||||
|
@ -63,6 +63,6 @@ class Module(ModuleManager.BaseModule):
|
|||
event["stdout"].write("Random Word: %s - Definition: %s" % (
|
||||
page["word"], definition["text"]))
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
else:
|
||||
event["stderr"].write("Try again in a couple of seconds")
|
||||
|
|
|
@ -29,7 +29,7 @@ class Module(ModuleManager.BaseModule):
|
|||
else:
|
||||
event["stderr"].write("No results found")
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
else:
|
||||
event["stderr"].write("No phrase provided")
|
||||
|
||||
|
@ -56,6 +56,6 @@ class Module(ModuleManager.BaseModule):
|
|||
else:
|
||||
event["stderr"].write("No suggestions found")
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
else:
|
||||
event["stderr"].write("No phrase provided")
|
||||
|
|
|
@ -23,4 +23,4 @@ class Module(ModuleManager.BaseModule):
|
|||
event["stdout"].write("It seems '%s' has not been pwned" % (
|
||||
event["args"]))
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
|
|
|
@ -28,4 +28,4 @@ class Module(ModuleManager.BaseModule):
|
|||
else:
|
||||
event["stderr"].write("Title not found")
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
|
|
|
@ -52,7 +52,7 @@ class Module(ModuleManager.BaseModule):
|
|||
else:
|
||||
event["stderr"].write("No geoip data found")
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
|
||||
@utils.hook("received.command.rdns")
|
||||
def rdns(self, event):
|
||||
|
|
|
@ -84,4 +84,4 @@ class Module(ModuleManager.BaseModule):
|
|||
"The user '%s' has never scrobbled before" % (
|
||||
shown_username))
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
|
|
|
@ -59,4 +59,4 @@ class Module(ModuleManager.BaseModule):
|
|||
event["stdout"].write("%s [%s] (posted by %s) %s" % (title,
|
||||
duration, user, link))
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
|
|
|
@ -24,4 +24,4 @@ class Module(ModuleManager.BaseModule):
|
|||
else:
|
||||
event["stderr"].write("No results found")
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
|
|
|
@ -41,4 +41,4 @@ class Module(ModuleManager.BaseModule):
|
|||
else:
|
||||
event["stderr"].write("Category not found")
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
|
|
|
@ -54,4 +54,4 @@ class Module(ModuleManager.BaseModule):
|
|||
event["stderr"].write(
|
||||
"%s is not watching anything" % username)
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
|
|
|
@ -47,4 +47,4 @@ class Module(ModuleManager.BaseModule):
|
|||
", size: %s, price: %s)" % (
|
||||
brand, title, description, weight, size, pricing))
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
|
|
|
@ -32,4 +32,4 @@ class Module(ModuleManager.BaseModule):
|
|||
else:
|
||||
event["stderr"].write("No results found")
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
|
|
|
@ -33,4 +33,4 @@ class Module(ModuleManager.BaseModule):
|
|||
else:
|
||||
event["stderr"].write("No weather information for this location")
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
|
|
|
@ -25,5 +25,5 @@ class Module(ModuleManager.BaseModule):
|
|||
else:
|
||||
event["stderr"].write("No results found")
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
|
||||
|
|
|
@ -25,4 +25,4 @@ class Module(ModuleManager.BaseModule):
|
|||
else:
|
||||
event["stdout"].write("No results")
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
|
|
|
@ -99,7 +99,7 @@ class Module(ModuleManager.BaseModule):
|
|||
else:
|
||||
event["stderr"].write("No videos found")
|
||||
else:
|
||||
event["stderr"].write("Failed to load results")
|
||||
raise utils.EventsResultsError()
|
||||
if video_id:
|
||||
event["stdout"].write(self.video_details(video_id))
|
||||
else:
|
||||
|
|
|
@ -136,6 +136,9 @@ def prevent_highlight(nickname):
|
|||
|
||||
class EventError(Exception):
|
||||
pass
|
||||
class EventsResultsError(EventError):
|
||||
def __init__(self):
|
||||
EventError.__init__(self, "Failed to load results")
|
||||
|
||||
def _set_get_append(obj, setting, item):
|
||||
if not hasattr(obj, setting):
|
||||
|
|
Loading…
Reference in a new issue