mirror of
https://github.com/inventree/InvenTree.git
synced 2025-11-30 09:20:03 +00:00
Better handling of an invalid config file (#10857)
* Better handling of an invalid config file * Remove dud line
This commit is contained in:
@@ -7,6 +7,7 @@ import os
|
||||
import random
|
||||
import shutil
|
||||
import string
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
@@ -195,7 +196,13 @@ def load_config_data(set_cache: bool = False) -> map | None:
|
||||
cfg_file = get_config_file()
|
||||
|
||||
with open(cfg_file, encoding='utf-8') as cfg:
|
||||
data = yaml.safe_load(cfg)
|
||||
try:
|
||||
data = yaml.safe_load(cfg)
|
||||
except yaml.parser.ParserError as error:
|
||||
logger.error(
|
||||
"Error reading InvenTree configuration file '%s': %s", cfg_file, error
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
# Set the cache if requested
|
||||
if set_cache:
|
||||
|
||||
Reference in New Issue
Block a user