mirror of
https://github.com/esphome/esphome.git
synced 2024-11-22 15:08:10 +01:00
Fix exception handling when loading packages (#5569)
This commit is contained in:
parent
e80bd8ed3d
commit
ec835c0b05
1 changed files with 13 additions and 8 deletions
|
@ -139,17 +139,22 @@ def _process_base_package(config: dict) -> dict:
|
||||||
) from e
|
) from e
|
||||||
return packages
|
return packages
|
||||||
|
|
||||||
packages = {}
|
packages = None
|
||||||
|
error = ""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
packages = get_packages(files)
|
packages = get_packages(files)
|
||||||
except cv.Invalid:
|
except cv.Invalid as e:
|
||||||
|
error = e
|
||||||
|
try:
|
||||||
if revert is not None:
|
if revert is not None:
|
||||||
revert()
|
revert()
|
||||||
packages = get_packages(files)
|
packages = get_packages(files)
|
||||||
finally:
|
except cv.Invalid as er:
|
||||||
|
error = er
|
||||||
|
|
||||||
if packages is None:
|
if packages is None:
|
||||||
raise cv.Invalid("Failed to load packages")
|
raise cv.Invalid(f"Failed to load packages. {error}")
|
||||||
|
|
||||||
return {"packages": packages}
|
return {"packages": packages}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue