Closed karsanU closed 2 years ago
I am not sure how this could happen given Reddit is always giving the correctly formatted JSON.
For some reason you seem to be getting html instead of json back, you'll have to handle the error in your application. simple-get
will call your callback with an error, and the third parameter will be the un-parsed data.
SyntaxError: API error: Unexpected token < in JSON at position 0 at JSON.parse ()
at C:\xampp\htdocs\paper-hands-service-node\node_modules\simple-get\index.js:84:23
at PassThrough. (C:\xampp\htdocs\paper-hands-service-node\node_modules\simple-concat\index.js:8:13) at Object.onceWrapper (even at Object.onceWrapper (events.js:421:28)
at PassThrough.emit (events.js:315:20)
at endReadableNT (internal/streams/readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
I am fetching the Reddit API. After about 5 hours (18k requests later) of that, I am running into this error. I am not sure how this could happen given Reddit is always giving the correctly formatted JSON.