Raise an error with all notifications for module initialisation error.
This commit is contained in:
Родитель
696e8dce6c
Коммит
8096574a2b
|
@ -211,6 +211,14 @@ Connection.prototype.connect = function () {
|
|||
socketOptions.socket.connect(this.options['port'], this.options['gateway']);
|
||||
}.bind(this)).fail(function (error) {
|
||||
debug("Module initialisation error:", error);
|
||||
|
||||
// This is a pretty fatal scenario, we don't have key/certificate to connect to APNS, there's not much we can do, so raise errors and clear the queue.
|
||||
while(this.notificationBuffer.length > 0) {
|
||||
var notification = this.notificationBuffer.shift();
|
||||
this.raiseError(error, notification.notification, notification.recipient);
|
||||
this.emit('transmissionError', Errors['moduleInitialisationFailed'], notification.notification, notification.recipient);
|
||||
}
|
||||
this.raiseError(error);
|
||||
this.emit('error', error);
|
||||
this.deferredConnection.reject(error);
|
||||
this.deferredConnection = null;
|
||||
|
|
|
@ -15,7 +15,8 @@ var Errors = {
|
|||
'invalidToken': 8,
|
||||
'apnsShutdown': 10,
|
||||
'none': 255,
|
||||
'retryLimitExceeded': 512
|
||||
'retryLimitExceeded': 512,
|
||||
'moduleInitialisationFailed': 513
|
||||
};
|
||||
|
||||
module.exports = Errors;
|
Загрузка…
Ссылка в новой задаче