BadAlias error message doesn't include filename
Parse errors from YAML.load_file will include the filename, which is useful in case you're e.g. parsing a number of configuration files:
File.write('/tmp/file.yaml', "\tfoo:"); YAML.load_file('/tmp/file.yaml')
#=> Psych::SyntaxError: (/tmp/file.yaml): found character that cannot start any token while scanning for the next token at line 1 column 1
However, errors with alias resolution will not:
File.write('/tmp/file.yaml', "foo: *bar"); YAML.load_file('/tmp/file.yaml')
#=> Psych::BadAlias: Unknown alias: bar
Is there any obvious way to tag that exception with the relevant filename, if applicable? It doesn't appear that the parsed document retains a reference to the filename, which probably makes this trickier.
We could probably add the origin filename to the AST produced by parsing the YAML file, then we could include the filename in the exception. However, line number info might be prohibitively expensive.
Yeah, that would be totally fine for my use-case. (We have a bunch of YAML config files, and given a file and missing alias it's quite easy to go and fix it.)