New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add source maps for YAML parse errors #30

merged 1 commit into from Dec 11, 2015


None yet
2 participants

danielgtaylor commented Dec 11, 2015

There are two caveats:

  1. We only get the first error.
  2. We only get a single position, so the source map points to one character.

cc @smizell


View changes

src/adapter.js Outdated
@@ -332,6 +332,13 @@ export function parse({minim, source, generateSourceMap}, done) {
} catch (err) {
makeAnnotation(Annotation, Link, SourceMap, null, parseResult,
ANNOTATIONS.CANNOT_PARSE, null, 'Problem loading the input');
if (err.mark) {
parseResult.content[0].attributes.set('sourceMap', [

This comment has been minimized.


smizell Dec 11, 2015


You may want to use .first()?


This comment has been minimized.


danielgtaylor commented Dec 11, 2015

@smizell updated based on comments 😄

smizell added a commit that referenced this pull request Dec 11, 2015

@smizell smizell merged commit 53cff3e into master Dec 11, 2015

3 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
continuous-integration/travis-ci/push The Travis CI build passed
coverage/coveralls Coverage increased (+0.009%) to 98.246%

@smizell smizell deleted the daniel/yaml-error-source-map branch Dec 11, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment