标签异常
引发异常时,可以添加一个标签,它将替换
示例 yaml_snippet
a: 1
b:
- 1
- 2
from strictyaml import Map, Int, load, YAMLValidationError
标签 myfilename
load(yaml_snippet, Map({"a": Int(), "b": Map({"x": Int(), "y": Int()})}), label="myfilename")
strictyaml.exceptions.YAMLValidationError:
when expecting a mapping
in "myfilename", line 2, column 1:
b:
^ (line: 2)
found a sequence
in "myfilename", line 4, column 1:
- '2'
^ (line: 4)