openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From csantan...@apache.org
Subject [incubator-openwhisk-package-alarms] branch master updated: check if we should disable trigger for status codes on error object (#173)
Date Tue, 18 Dec 2018 03:31:39 GMT
This is an automated email from the ASF dual-hosted git repository.

csantanapr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-package-alarms.git


The following commit(s) were added to refs/heads/master by this push:
     new 0ee1bad  check if we should disable trigger for status codes on error object (#173)
0ee1bad is described below

commit 0ee1badaedf046fe36d68e82ebc981e496b0283a
Author: Jason Peterson <jasonpet@us.ibm.com>
AuthorDate: Mon Dec 17 22:31:35 2018 -0500

    check if we should disable trigger for status codes on error object (#173)
---
 provider/lib/utils.js | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/provider/lib/utils.js b/provider/lib/utils.js
index 6dde7ef..943dbe2 100644
--- a/provider/lib/utils.js
+++ b/provider/lib/utils.js
@@ -113,11 +113,15 @@ module.exports = function(logger, triggerDB, redisClient) {
                             triggerData.triggersLeft++;
                         }
 
-                        if (!error && shouldDisableTrigger(statusCode)) {
-                            //disable trigger
-                            var message = 'Automatically disabled after receiving a ' + statusCode
+ ' status code when firing the trigger';
-                            disableTrigger(triggerIdentifier, statusCode, message);
-                            reject('Disabled trigger ' + triggerIdentifier + ' due to status
code: ' + statusCode);
+                        if (statusCode && shouldDisableTrigger(statusCode)) {
+                            var message;
+                            try {
+                                message = error.error.errorMessage;
+                            } catch (e) {
+                                message = `Received a ${statusCode} status code when firing
the trigger`;
+                            }
+                            disableTrigger(triggerIdentifier, statusCode, `Trigger automatically
disabled: ${message}`);
+                            reject(`Disabled trigger ${triggerIdentifier}: ${message}`);
                         }
                         else {
                             if (retryCount < retryAttempts) {


Mime
View raw message