kengz / spacy-nlp

Expose Spacy nlp text parsing to Nodejs (and other languages) via socketIO
MIT License
225 stars 58 forks source link

Error logging in caller appears to be affected #2

Open ignorantlibrarian opened 7 years ago

ignorantlibrarian commented 7 years ago

Hi there,

It's really great to be able to use the Spacy.io parser with Node.js thanks to these modules. But it seems adversely to affect the error handling of my own code.

I have a server script that communicates, via socket.io, with a client written in React.js. The server script, server.js, passes text to a parser dependent on spacy-nlp, which I've implemented like so:

nlp_server.js: const spacyNLP = require('spacy-nlp')

var serverPromise = spacyNLP.server({ port: process.env.IOPORT }) .catch(err => console.error(err));

parser.js: const spacyNLP = require('spacy-nlp');

const nlp = spacyNLP.nlp;

And in server.js, I make calls to parser.js, e.g.: const parser = require('./parser.js'); parser.parse(text).then(result => console.log(result)).catch(error => console.error(error));

The server.js script uses a socket.io connection to the client on a completely different port, and I think I've got error handlers everywhere I should that pipe errors to the console. But when using spacy-nlp, various errors in my code fail to bubble up with the full stack trace:

screenshot

When I replace the nlp dependency in server.js with a dummy object, error logging to the console is verbose as usual.

It may be that I'm overlooking something obvious, so please pardon my ignorance if that's the case.

Thanks!

kengz commented 7 years ago

Will look deeper when I have time, but here's a valuable information.

The polysocketio library (which this module depends on) will find an existing socket io server into he same node runtime, and if it finds one it will join it, instead of spawning an independent server.

The error logger seems nasty - all socketIO logic is handled by the dependended module poly-socketio, so that where you'd wanna dig. I'll try to look soon too. Thanks for letting me know.

On Jan 22, 2017, 1:00 PM -0500, Dolsy Smith notifications@github.com, wrote:

Hi there,

It's really great to be able to use the Spacy.io parser with Node.js thanks to these modules. But it seems adversely to affect the error handling of my own code.

I have a server script that communicates, via socket.io, with a client written in React.js. The server script, server.js, passes text to a parser dependent on spacy-nlp, which I've implemented like so:

nlp_server.js: `const spacyNLP = require('spacy-nlp')

var serverPromise = spacyNLP.server({ port: process.env.IOPORT }) .catch(err => console.error(err)); parser.js:const spacyNLP = require('spacy-nlp');

const nlp = spacyNLP.nlp;`

And in server.js, I make calls to parser.js, e.g.: const parser = require('./parser.js'); parser.parse(text).then(result => console.log(result)).catch(error => console.error(error));

The server.js script uses a socket.io connection to the client on a completely different port, and I think I've got error handlers everywhere I should that pipe errors to the console. But various errors in my code fail to bubble up when using spacy-nlp:

When I replace the nlp dependency in server.js with a dummy object, error logging to the console is verbose as usual.

It may be that I'm overlooking something obvious, so please pardon my ignorance if that's the case.

Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub (https://github.com/kengz/spacy-nlp/issues/2), or mute the thread (https://github.com/notifications/unsubscribe-auth/AH1Db5Cd9h3vgbVtH-97dLdOcCFi89u-ks5rU5k4gaJpZM4Lqc8p).

kengz commented 6 years ago

New fix from #10 published. Please bump version to 1.0.8 and give it a try.