Socket errors handling #22
Labels
No labels
dependencies
javascript
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
quodatum/basex-node#22
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hello. When I open BaseX session and then restart the server while the session keeps idle, I've got such error if I try to perform a query:
Is it possible to catch such errors in the user code? If not, I guess it's need to implement some error handling features for Session and/or Query constructors.
As I can see at this time there is only console output performed:
This is a long standing deficiency see #9
I have created a dev branch where the session object emits socketError events
https://github.com/apb2006/basex-node/blob/dev/index.js#L156
An example
https://github.com/apb2006/basex-node/blob/dev/examples/issue22.js
Would this meet your requirements?
I think it's better than nothing at least and I will be able to deal with these errors. So if it doesn't conflict with your API design opinions you should push this patch to the stable branch I guess. Thanks.
v0.9.0 now on npm has this update and a few cleanups.
I have also updated
https://github.com/apb2006/basex-node/blob/dev/examples/issue22.js
to show use of this feature.
I am very happy to take suggestions/pull request for any improvements. I am not an expert on the range of socket errors that could arise here.
Closing this as the v0.9 release provides the means to detect and respond to socket errors. See #9 for additional features that could be implement to provide cleaner session handling in these cases.