Skip to content
This repository has been archived by the owner on Jul 2, 2019. It is now read-only.

Add source maps for YAML parse errors #30

Merged
merged 1 commit into from
Dec 11, 2015

Conversation

danielgtaylor
Copy link
Contributor

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

@@ -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', [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may want to use .first()?

@danielgtaylor
Copy link
Contributor Author

@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
@smizell smizell deleted the daniel/yaml-error-source-map branch December 11, 2015 21:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants