node-nats-streaming-buffered-client
Advanced tools
Comparing version 1.3.4 to 1.3.5
@@ -319,6 +319,18 @@ "use strict"; | ||
_this.logger.error('[NATS-BUFFERED-CLIENT] Publish failed', error); | ||
_this.logger.error('[NATS-BUFFERED-CLIENT] Error type', typeof error); | ||
// Push the item back onto the buffer | ||
// | ||
_this.buffer.unshift(pub_1); | ||
if (error && error.message === 'stan: publish ack timeout') { | ||
// Try to retrieve the actual error message | ||
// Errors thrown in the client are normal JS Error objects | ||
// Errors returned from the server appear to be strings | ||
// | ||
var errorMessage = void 0; | ||
try { | ||
errorMessage = typeof error === 'string' ? error : error.message; | ||
} | ||
catch (unknownErrorTypeError) { | ||
_this.logger.warn('[NATS-BUFFERED-CLIENT] Failed to interpret error type', error); | ||
} | ||
if (errorMessage === 'stan: publish ack timeout') { | ||
_this.logger.warn('[NATS-BUFFERED-CLIENT] Publish time-out detected', error); | ||
@@ -332,3 +344,6 @@ } | ||
// | ||
if (error && error.message === 'stan: invalid publish request') { | ||
// NOTE: Be cautious about reconnecting. If subscriptions are not closed you | ||
// end up with a client id already registered error | ||
// | ||
if (errorMessage === 'stan: invalid publish request') { | ||
_this.reconnect() | ||
@@ -335,0 +350,0 @@ .then(function () { |
{ | ||
"name": "node-nats-streaming-buffered-client", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
Sorry, the diff of this file is not supported yet
34265
505