mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Core] Give friendly error when provided instance name doesn't exist. (#2969)
* Update data_manager.py * Towncrier entry
This commit is contained in:
parent
6bb1004bcd
commit
80628a28a7
1
changelog.d/2968.bugfix.rst
Normal file
1
changelog.d/2968.bugfix.rst
Normal file
@ -0,0 +1 @@
|
|||||||
|
Give friendly error when provided instance name doesn't exist.
|
||||||
@ -91,14 +91,20 @@ def load_basic_configuration(instance_name_: str):
|
|||||||
try:
|
try:
|
||||||
with config_file.open(encoding="utf-8") as fs:
|
with config_file.open(encoding="utf-8") as fs:
|
||||||
config = json.load(fs)
|
config = json.load(fs)
|
||||||
except (FileNotFoundError, KeyError):
|
except FileNotFoundError:
|
||||||
print(
|
print(
|
||||||
"You need to configure the bot instance using `redbot-setup`"
|
"You need to configure the bot instance using `redbot-setup`"
|
||||||
" prior to running the bot."
|
" prior to running the bot."
|
||||||
)
|
)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
try:
|
||||||
basic_config = config[instance_name]
|
basic_config = config[instance_name]
|
||||||
|
except KeyError:
|
||||||
|
print(
|
||||||
|
"Instance with this name doesn't exist."
|
||||||
|
" You can create new instance using `redbot-setup` prior to running the bot."
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def _base_data_path() -> Path:
|
def _base_data_path() -> Path:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user