You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When parsing a yaml file with an anchor, yaml2jsonnet generates a traceback:
$ cat anchor-example.yamlfoo: &foo-ref key-1: "val-1" key-2: "val-2"var: *foo-ref
$ yaml2jsonnet anchor-example.yamlTraceback (most recent call last): File "/home/user/.local/bin/yaml2jsonnet", line 8, in <module> sys.exit(main()) File "/home/user/.local/lib/python3.9/site-packages/yaml2jsonnet/cli.py", line 58, in main run(args) File "/home/user/.local/lib/python3.9/site-packages/yaml2jsonnet/cli.py", line 47, in run convert_yaml(yaml_data, args.out, args.document_comments) File "/home/user/.local/lib/python3.9/site-packages/yaml2jsonnet/yaml2jsonnet.py", line 14, in convert_yaml JsonnetRenderer(events, output, array, inject_comments).render() File "/home/user/.local/lib/python3.9/site-packages/yaml2jsonnet/jsonnet_renderer.py", line 210, in render self.state.send(event) File "/home/user/.local/lib/python3.9/site-packages/yaml2jsonnet/jsonnet_renderer.py", line 383, in _mapping_value raise UnhandledEventError(self, event)yaml2jsonnet.jsonnet_renderer.UnhandledEventError: Event was not handled by the current state: Last event was AliasEvent(anchor='foo-ref'), the state was _mapping_value, the queue was [(StreamStartEvent,_start), (DocumentStartEvent,_stream), (MappingStartEvent,_document)]
Instead it'd be nice to show an error like "Yaml anchors are not supported. Please remove them and try again."
The text was updated successfully, but these errors were encountered:
The UnhandledEventError is for unknown unknowns, so to speak. I didn't remember that anchors were a thing and never tested them. If you've got an idea for how to handle generic errors in a friendlier way, though, I'm interested.
The YAML parsing library that I'm using seems to handle anchors (it's not giving an error, it's giving me an event that I'm not handling). Presumably, it'd be pretty easy to add anchors. If I get some time, I'll try adding it.
When parsing a yaml file with an anchor,
yaml2jsonnet
generates a traceback:Instead it'd be nice to show an error like "Yaml anchors are not supported. Please remove them and try again."
The text was updated successfully, but these errors were encountered: