-
-
Notifications
You must be signed in to change notification settings - Fork 12
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
Unhandled error event in case of malformed response #8
Comments
Glad you got it working! I've very little time for updates so a PR is always greatly appreciated if you catch any errors 👍 |
Ok! |
I'm gonna fix this a year+ later, any chance you remember reproduction steps? |
IMHO it can still happen here: https://github.com/lacymorrow/album-art/blob/master/index.js#L63 To replicate simply mock the response with an invalid json format (for example a string) |
I see it now, great catch! |
I got a bug report signalling that the module does not properly handle malformed replies (or non json replies) from audioscrobbler server.
See:
Oct 10 16:29:07 volumio volumio[1088]: undefined:1
Oct 10 16:29:07 volumio volumio[1088]:
Oct 10 16:29:07 volumio volumio[1088]: ^
Oct 10 16:29:07 volumio volumio[1088]: SyntaxError: Unexpected token < in JSON at position 0
Oct 10 16:29:07 volumio volumio[1088]: at Object.parse (native)
Oct 10 16:29:07 volumio volumio[1088]: at IncomingMessage. (/volumio/node_modules/album-art/index.js:29:22)
Oct 10 16:29:07 volumio volumio[1088]: at emitNone (events.js:91:20)
Oct 10 16:29:07 volumio volumio[1088]: at IncomingMessage.emit (events.js:185:7)
Oct 10 16:29:07 volumio volumio[1088]: at endReadableNT (_stream_readable.js:974:12)
Oct 10 16:29:07 volumio volumio[1088]: at _combinedTickCallback (internal/process/next_tick.js:80:11)
Oct 10 16:29:07 volumio volumio[1088]: at process._tickCallback (internal/process/next_tick.js:104:9)
Maybe a try catch in https://github.com/lacymorrow/album-art/blob/master/index.js#L30 would solve it?
The text was updated successfully, but these errors were encountered: