Skip to content
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 error location properties to parser error #220

Open
marekweb opened this issue Nov 17, 2017 · 0 comments
Open

Add error location properties to parser error #220

marekweb opened this issue Nov 17, 2017 · 0 comments

Comments

@marekweb
Copy link

Currently when there's a parser error, the location of the error is appended as a string to the error message.

Error: Unexpected close tag
Line: 0
Column: 17
Char: >

It would be useful to provide the location as a set of properties on the object.

{
  line: 0,
  column: 17,
  char: '>'
}

Use cases:

Better error reporting. Allow the possibility of excerpting the XML input to show the location of the error.

parser.onerror = function(error) {
  console.error('Parsing error at location: ' + error.line + ':' + error.column)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant