-
Notifications
You must be signed in to change notification settings - Fork 447
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
Unexpected end of JSON input #219
Comments
What version of LeapJS are you using? What version of the leap Service? What hardware? As a hack, you should be able to put a try/catch inside the pseudocode: handleData = myController.connection.handleData
myController.connection.handleData = function() {
try {
handleData()
}
} |
Thanks for the suggestion! I'm using LeapJS 0.6.4, service 2.3.1 on macOS Sierra, model LM-010. Indeed the hack seems to work when fleshed out like this: myController.on('connect', function() {
var origHandleData = this.connection.handleData;
this.connection.handleData = function(data) {
try {
return origHandleData.call(this, data);
} catch (e) {
console.log(e);
}
};
}); Anyway, I believe this needs to be fixed in the library, maybe in the form of an error callback: myController.on('error', function() {...}); Otherwise leapjs cannot be used safely with node at this point. |
I encountered the same problem. I solved this directly inside the leapjs code by surrounding the JSON.parse(data) with a try-catch-block.
Anyway I believe too that this should be fixed inside the library itself as aknoerig suggested. |
When using leapjs via node, the frame data once in a while seems to be incomplete and crashes with the error below.
So far I couldn't find a way for error handling this properly, so this is also crashing my node server, stopping all processes.
Is there maybe a callback for this error, or a way to wrap this in a try/catch block?
The text was updated successfully, but these errors were encountered: