[Core] Specify an error message on package loading (#2207)

Allows cog creators to explain clearly why a cog cannot load by raising  `redbot.core.errors.CogLoadError`. Instead of having to check in the console what's wrong, the message will directly be sent in the context channel.
This commit is contained in:
El Laggron
2018-10-11 02:57:11 +02:00
committed by Toby Harradine
parent c464f5e7dc
commit a64db76b4d
2 changed files with 42 additions and 4 deletions

View File

@@ -14,3 +14,10 @@ class PackageAlreadyLoaded(RedError):
def __str__(self) -> str:
return f"There is already a package named {self.spec.name.split('.')[-1]} loaded"
class CogLoadError(RedError):
"""Raised by a cog when it cannot load itself.
The message will be send to the user."""
pass