-
Notifications
You must be signed in to change notification settings - Fork 30
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
Error in jsonld parse #24
Comments
@floflock Can you include a code snippet to reproduce this issue? |
Sure, here is the code: const wae = require('web-auto-extractor').default
const html = '<html></html>' // from a request of my development server
wae().parse(html) Maybe you try this page: |
@floflock This should be easy to handle by wrapping the |
ok, that's clear for me, but I thought it was conceptional wrong to throw syntax error, if there is no json-ld present. :) |
Throwing is better, so you know your input isn't in the expected format. |
Try/catch isn't possible, because it is a `console.log()`` try {
return wae().parse(html)
} catch (e) {
//
} |
@floflock Okay so the error isn't thrown, it is just a log statement; it should be ignorable. |
FWIW I'm working on this now and expected it to throw. I do get the log message, but that's not as explicit as throwing and handling a specific case. Alternative designs:
|
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 indix#24
Hi @paambaati, I trust that you're all quite busy so I don't mean to come off with any undue urgency. Is Indix open to contributions on this project? Given your estimation on time available to review submissions, do you recommend I work off a fork for a while? |
@paambaati would you be so kind to give short feedback on that topic? |
@paambaati thanks for your feedback. I use your package in a certain project. I've made a fork and will try to improve some things. |
Hey there,
how can I prevent this error thrown by
jsonld-parser.js
?The input html code has no jsonld, this why w-a-e is throwing the error.
Maybe, w-a-e should try if json-ld is present, because the error message is wrong at the moment if now json-ld is in the html - right?
The text was updated successfully, but these errors were encountered: