Skip to content

Include additional structured information in error objects #26

Description

@g-a-v-i-n

Thanks for this library, its the only one I've found with useful, descriptive error handling besides the DOMParser.

Would it be possible to extend the error object to break down the message a bit more? What I have in mind is to go from this:

Unclosed start tag for element `text` (line 1, column 243) iddle text-anchor="middle" font-size="200px" fill= ^ 

To this:

{
  errorCode: 0,
  message: Unclosed start tag for element,
  element: 'text',
  line: 1,
  col, 243,
  snippet: `middle text-anchor="middle" font-size="200px" fill=`
}

I know some of those entries are already in the object, which is great. Having the extra ones, like errorCode, message and element or similar would help with UI work.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions