mirror of
https://github.com/esphome/esphome.git
synced 2024-12-23 16:47:57 +01:00
Add new Error type to skip prepending path (#6716)
This commit is contained in:
parent
026c3a69b8
commit
8280772b91
@ -148,6 +148,8 @@ class Config(OrderedDict, fv.FinalValidateConfig):
|
|||||||
path = path or []
|
path = path or []
|
||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
|
except cv.FinalExternalInvalid as e:
|
||||||
|
self.add_error(e)
|
||||||
except vol.Invalid as e:
|
except vol.Invalid as e:
|
||||||
e.prepend(path)
|
e.prepend(path)
|
||||||
self.add_error(e)
|
self.add_error(e)
|
||||||
|
@ -267,6 +267,10 @@ class Required(vol.Required):
|
|||||||
super().__init__(key, msg=msg)
|
super().__init__(key, msg=msg)
|
||||||
|
|
||||||
|
|
||||||
|
class FinalExternalInvalid(Invalid):
|
||||||
|
"""Represents an invalid value in the final validation phase where the path should not be prepended."""
|
||||||
|
|
||||||
|
|
||||||
def check_not_templatable(value):
|
def check_not_templatable(value):
|
||||||
if isinstance(value, Lambda):
|
if isinstance(value, Lambda):
|
||||||
raise Invalid("This option is not templatable!")
|
raise Invalid("This option is not templatable!")
|
||||||
|
Loading…
Reference in New Issue
Block a user