notification-processor 4.19.5 → 4.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.node-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
12.22.12
|
package/lib/processor.js
CHANGED
|
@@ -70,7 +70,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
70
70
|
value: function process(context, raw) {
|
|
71
71
|
var _this2 = this;
|
|
72
72
|
|
|
73
|
-
var $promise, execute, id, notification;
|
|
73
|
+
var $promise, _isIgnoredError, execute, id, notification;
|
|
74
74
|
boundMethodCheck(this, Processor);
|
|
75
75
|
id = uuid();
|
|
76
76
|
notification = this.source.newNotification({
|
|
@@ -94,9 +94,12 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
94
94
|
});
|
|
95
95
|
});
|
|
96
96
|
};
|
|
97
|
+
_isIgnoredError = function _isIgnoredError(error) {
|
|
98
|
+
return error instanceof IgnoredError;
|
|
99
|
+
};
|
|
97
100
|
execute().tap(function () {
|
|
98
101
|
return _this2._emitEvent("successful", { context: context, id: id, notification: notification });
|
|
99
|
-
}).catch(
|
|
102
|
+
}).catch(_isIgnoredError, function (error) {
|
|
100
103
|
return _this2._emitEvent("successful", {
|
|
101
104
|
context: context,
|
|
102
105
|
id: id,
|
|
@@ -15,16 +15,20 @@
|
|
|
15
15
|
notificationApiUrl = _ref.notificationApiUrl,
|
|
16
16
|
maxRetries = _ref.maxRetries,
|
|
17
17
|
_ref$nonRetryable = _ref.nonRetryable,
|
|
18
|
-
nonRetryable = _ref$nonRetryable === undefined ? [400] : _ref$nonRetryable
|
|
18
|
+
nonRetryable = _ref$nonRetryable === undefined ? [400] : _ref$nonRetryable,
|
|
19
|
+
_ref$silentErrors = _ref.silentErrors,
|
|
20
|
+
silentErrors = _ref$silentErrors === undefined ? [] : _ref$silentErrors;
|
|
19
21
|
|
|
20
22
|
var jobProcesor;
|
|
21
23
|
jobProcesor = new JobProcessor({
|
|
22
24
|
processor: RequestAsyncProcessor({
|
|
23
25
|
apiUrl: apiUrl,
|
|
24
|
-
fullResponse: true
|
|
26
|
+
fullResponse: true,
|
|
27
|
+
silentErrors: silentErrors
|
|
25
28
|
}),
|
|
26
29
|
maxRetries: maxRetries,
|
|
27
30
|
nonRetryable: nonRetryable,
|
|
31
|
+
silentErrors: silentErrors,
|
|
28
32
|
notificationApiUrl: notificationApiUrl
|
|
29
33
|
});
|
|
30
34
|
return function (it, context, executionId) {
|
|
@@ -56,6 +56,7 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
|
|
|
56
56
|
_this.notificationApiUrl = args.notificationApiUrl;
|
|
57
57
|
_this.notificationApiAsyncUrl = args.notificationApiAsyncUrl;
|
|
58
58
|
_this.nonRetryable = args.nonRetryable;
|
|
59
|
+
_this.silentErrors = args.silentErrors;
|
|
59
60
|
return _this;
|
|
60
61
|
}
|
|
61
62
|
|
|
@@ -6,7 +6,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
6
6
|
|
|
7
7
|
// Generated by CoffeeScript 2.7.0
|
|
8
8
|
(function () {
|
|
9
|
-
var MaxRetriesProcessor;
|
|
9
|
+
var IgnoredError, MaxRetriesProcessor;
|
|
10
|
+
|
|
11
|
+
IgnoredError = require("../exceptions/ignored.error");
|
|
10
12
|
|
|
11
13
|
module.exports = MaxRetriesProcessor = function () {
|
|
12
14
|
function MaxRetriesProcessor(_ref) {
|
|
@@ -28,6 +30,9 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
28
30
|
return this.processor(notification, context, executionId).tap(function (it) {
|
|
29
31
|
return _this._onSuccess_(notification, it);
|
|
30
32
|
}).catch(function (err) {
|
|
33
|
+
if (_this._isIgnoredError_(err)) {
|
|
34
|
+
return _this._onIgnoredError_(notification, err);
|
|
35
|
+
}
|
|
31
36
|
if (_this._shouldRetry_(notification, err)) {
|
|
32
37
|
throw _this._sanitizeError_(err);
|
|
33
38
|
}
|
|
@@ -57,6 +62,16 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
|
|
|
57
62
|
value: function _onMaxRetryExceeded_(notification, err) {
|
|
58
63
|
throw new Error("subclass responsability");
|
|
59
64
|
}
|
|
65
|
+
}, {
|
|
66
|
+
key: "_onIgnoredError_",
|
|
67
|
+
value: function _onIgnoredError_(notification, err) {
|
|
68
|
+
throw err;
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "_isIgnoredError_",
|
|
72
|
+
value: function _isIgnoredError_(err) {
|
|
73
|
+
return err instanceof IgnoredError;
|
|
74
|
+
}
|
|
60
75
|
}]);
|
|
61
76
|
|
|
62
77
|
return MaxRetriesProcessor;
|