mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-12 13:42:59 +00:00
fix: catch ConfigError in display preview generator
PR #282 narrowed bare except blocks but missed ConfigError from config_manager.load_config(), which wraps FileNotFoundError, JSONDecodeError, and OSError. Without this, a corrupt or missing config crashes the display preview SSE endpoint instead of falling back to 128x64 defaults. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ from datetime import datetime, timedelta
|
|||||||
sys.path.insert(0, str(Path(__file__).parent.parent))
|
sys.path.insert(0, str(Path(__file__).parent.parent))
|
||||||
|
|
||||||
from src.config_manager import ConfigManager
|
from src.config_manager import ConfigManager
|
||||||
|
from src.exceptions import ConfigError
|
||||||
from src.plugin_system.plugin_manager import PluginManager
|
from src.plugin_system.plugin_manager import PluginManager
|
||||||
from src.plugin_system.store_manager import PluginStoreManager
|
from src.plugin_system.store_manager import PluginStoreManager
|
||||||
from src.plugin_system.saved_repositories import SavedRepositoriesManager
|
from src.plugin_system.saved_repositories import SavedRepositoriesManager
|
||||||
@@ -492,7 +493,7 @@ def display_preview_generator():
|
|||||||
parallel = main_config.get('display', {}).get('hardware', {}).get('parallel', 1)
|
parallel = main_config.get('display', {}).get('hardware', {}).get('parallel', 1)
|
||||||
width = cols * chain_length
|
width = cols * chain_length
|
||||||
height = rows * parallel
|
height = rows * parallel
|
||||||
except (KeyError, TypeError, ValueError):
|
except (KeyError, TypeError, ValueError, ConfigError):
|
||||||
width = 128
|
width = 128
|
||||||
height = 64
|
height = 64
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user