fix(app_dsl_service): handle missing app mode with a ValueError (#11945)

Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
-LAN- 2024-12-22 10:40:12 +08:00 committed by GitHub
parent 3d07a94bd7
commit 2ad2a402fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -340,7 +340,10 @@ class AppDslService:
) -> App:
"""Create a new app or update an existing one."""
app_data = data.get("app", {})
app_mode = AppMode(app_data["mode"])
app_mode = app_data.get("mode")
if not app_mode:
raise ValueError("loss app mode")
app_mode = AppMode(app_mode)
# Set icon type
icon_type_value = icon_type or app_data.get("icon_type")