Labeling exceptions

When raising exceptions, you can add a label that will replace with whatever you want.

Example yaml_snippet:

a: 1
  - 1
  - 2
from strictyaml import Map, Int, load, YAMLValidationError

Label myfilename:

load(yaml_snippet, Map({"a": Int(), "b": Map({"x": Int(), "y": Int()})}), label="myfilename")
when expecting a mapping
  in "myfilename", line 2, column 1:
    ^ (line: 2)
found a sequence
  in "myfilename", line 4, column 1:
    - '2'
    ^ (line: 4)

Executable specification

Documentation automatically generated from handle-exceptions.story storytests.