Skip to content
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

Handling error during JSON parsing #315

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

aarthika
Copy link

Fix for a scenario where the memcache JSON data was stored in a improper format resulting in an error shown as below which invokes an uncaught exception. This can be prevented by the given solution.
SyntaxError: Unexpected token x in JSON at position 0
at JSON.parse ()
at Socket.value (/memcached/lib/memcached.js:514:26)
at Client.rawDataReceived (/memcached/lib/memcached.js:744:51)
at Client.BufferBuffer (/memcached/lib/memcached.js:678:12)
at Socket.bowlofcurry (/memcached/lib/utils.js:126:15)
at emitOne (events.js:115:13)
at Socket.emit (events.js:210:7)
at addChunk (_stream_readable.js:250:12)
at readableAddChunk (_stream_readable.js:233:13)
at Socket.Readable.push (_stream_readable.js:195:10)
at TCP.onread (net.js:586:20)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant