web-auto-extractor icon indicating copy to clipboard operation
web-auto-extractor copied to clipboard

Store JSON-LD parse errors

Open TheDahv opened this issue 5 years ago • 7 comments

Web Auto Extractor logs and skips parse errors it encounters when working on JSON+LD. However, a program cannot react to messages written to console.

This change allows a developer to hook into parse errors and react to them if desired.

Fix #24

TheDahv avatar Mar 07 '19 22:03 TheDahv

Interesting note about the failing tests: Travis runs tests against node v5.12. I wrote this code against v10.12.

It appears Node has different error messages:

  1) Web Auto Extractor when there are parse errors should save jsonld parse errors:
      AssertionError: expected [ Array(2) ] to deeply equal [ Array(2) ]
      + expected - actual
       [
      -  "Unexpected end of input"
      -  "Unexpected token '"
      +  "Unexpected end of JSON input"
      +  "Unexpected token ' in JSON at position 11"
       ]

I have a couple ideas, and I'm interested in your take:

  • write code that checks for fuzzy/near-matches of error messages, or matches against a set of known error messages
  • adjust the inner library to wrap parse errors and expose them with a consistent message
  • don't check for message type at all but just count reported errors to prove things are working correctly

TheDahv avatar Mar 07 '19 22:03 TheDahv

@TheDahv who can merge this branch?

floflock avatar May 09 '19 10:05 floflock

@floflock I don't know. I haven't been in contact with anyone from Indix.

TheDahv avatar May 09 '19 14:05 TheDahv

@floflock oh I just read the other thread. Sounds like he wants us to work from a fork.

In that case, we have 2 options:

  • you can clone this branch into a repo you manage and work from that
  • I can merge into my fork and remember to keep it up to speed occasionally

I suppose it comes down to which of the two of us wants to become a maintainer :/

TheDahv avatar May 09 '19 14:05 TheDahv

@TheDahv it is up to you. :) Currently, I am ignoring those type of log spam. 😆

In my opinion, there is more to do: new esm syntax or typescript, more test cases, ...

floflock avatar May 09 '19 19:05 floflock

Is there a more actively maintained similar library?

raine avatar Jul 08 '20 09:07 raine

I've made a fork and merged the changes from some of the other forks: https://github.com/raine/web-auto-extractor

Published as @rane/web-auto-extractor to npm.

raine avatar Jul 08 '20 10:07 raine