Open aschaal opened 1 month ago
In order to print the correct error message we will have to monkey patch the Psych and that should not cause any concerns as we will be updating the just the line number from the error message which we can find from psych handler.
But main challenge is the method that we are monkey patching i.e. Psych::Parser#parse. In Psych 4 this is coming from C code(PR) and monkey patching that we are hoping for will only be possible if we update underlying Psych to >= 5.
This can be done by adding runtime dependency in gemspec, but need to verify if this is the right approach.
Wrong number of spaces may lead to this error message: “did not find expected key while parsing a block mapping at line 1 column 1”
See also wrong line reported in 'did not find expected key while parsing a block mapping' · Issue #190 · ruby/psych
It would be nice to manually parse the YAML file when this error is returned to find the first occurrence where spaces before attributes are not correct to give the user a better hint where to look.