Skip to content

Commit

Permalink
[Core] Add error handling when [p]load tries to load "locales" (#6466)
Browse files Browse the repository at this point in the history
  • Loading branch information
sravan1946 authored Oct 20, 2024
1 parent d3887b5 commit 4e27059
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions redbot/core/_cog_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,12 @@ async def _find_core_cog(name: str) -> ModuleSpec:

try:
mod = import_module(real_name, package=package)
if mod.__spec__.name == "redbot.cogs.locales":
raise NoSuchCog(
"No core cog by the name of '{}' could be found.".format(name),
path=mod.__spec__.origin,
name=name,
)
except ImportError as e:
if e.name == package + real_name:
raise NoSuchCog(
Expand Down

0 comments on commit 4e27059

Please sign in to comment.