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 location properties on error object #221

Closed
wants to merge 3 commits into from
Closed

Add location properties on error object #221

wants to merge 3 commits into from

Conversation

marekweb
Copy link

Implements #220

When an error is thrown, the line, column and char are put into the error message but the values aren't accessible. This pull request adds the location as a set of properties on the error object:

er.line = parser.line
er.column = parser.column
er.char = parser.c

When handling the error, this makes the location information usable.

parser.onerror = function(error) {
  console.error('An error occured on line ' + error.line);
}

Added a test.

@marekweb
Copy link
Author

marekweb commented Feb 1, 2018

@isaacs Any feedback? Are you still maintaining sax-js?

@isaacs isaacs deleted the branch isaacs:master February 17, 2022 17:56
@isaacs isaacs closed this Feb 17, 2022
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

Successfully merging this pull request may close these issues.

2 participants