Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is only the initial version of how the new error handling could look like. This update utilizes zotero/stream-server#8 , which no longer closes the connection on error, but instead returns it as an error event with a message, code and requestID. This update allows to just use a callback function when creating a subscription, and the function is called when a message from stream-server is received with the same requestID. Currently implemented only for subscription creation.
'Reconnect on any error' commit makes zotero-api-node/stream.js to handle connection errors (i.e. ECONNREFUSED) by itself, instead of allowing them to bubble up to arkivo and crash the process. This is not ideal, because arkivo no longer know about errors inside stream.js. But connection error handler should be wrapped by reconnect logic, and currently the reconnect is handled inside stream.js (zotero-api-node). But for now it's still better than allowing process to crash on typical connection errors.