@shushed/helpers 0.0.141 → 0.0.142
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/dist/index.js +9 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -171453,7 +171453,6 @@ var TriggerHelper = class {
|
|
|
171453
171453
|
onExecute() {
|
|
171454
171454
|
const fn = async (config, options) => {
|
|
171455
171455
|
let executionFinished = false;
|
|
171456
|
-
let terminateResult = null;
|
|
171457
171456
|
let message;
|
|
171458
171457
|
const optionsEnchanced = {
|
|
171459
171458
|
...options,
|
|
@@ -171461,13 +171460,20 @@ var TriggerHelper = class {
|
|
|
171461
171460
|
...options.req,
|
|
171462
171461
|
throw: (code, message2) => {
|
|
171463
171462
|
executionFinished = true;
|
|
171464
|
-
|
|
171463
|
+
options.logging.error(message2 + ". Execution stoped.", code);
|
|
171465
171464
|
options.req.throw(code, message2);
|
|
171466
171465
|
}
|
|
171467
171466
|
},
|
|
171468
171467
|
terminate: (statusCode, message2) => {
|
|
171469
171468
|
executionFinished = true;
|
|
171470
|
-
|
|
171469
|
+
let messageAsObj = null;
|
|
171470
|
+
if (message2.trim().indexOf("{") === 0 || message2.trim().indexOf("[") === 0) {
|
|
171471
|
+
try {
|
|
171472
|
+
messageAsObj = JSON.parse(message2);
|
|
171473
|
+
} catch (_) {
|
|
171474
|
+
}
|
|
171475
|
+
}
|
|
171476
|
+
options.logging.log(messageAsObj || message2);
|
|
171471
171477
|
return options.terminate(statusCode, message2);
|
|
171472
171478
|
}
|
|
171473
171479
|
};
|
|
@@ -171591,12 +171597,6 @@ var TriggerHelper = class {
|
|
|
171591
171597
|
return;
|
|
171592
171598
|
}
|
|
171593
171599
|
}
|
|
171594
|
-
if (executionFinished) {
|
|
171595
|
-
if (terminateResult) {
|
|
171596
|
-
options.logging.log("Trigger finished without triggering the rest of workflow", terminateResult);
|
|
171597
|
-
}
|
|
171598
|
-
return;
|
|
171599
|
-
}
|
|
171600
171600
|
}
|
|
171601
171601
|
if (atLeastOneHandlerMatched && !executionFinished) {
|
|
171602
171602
|
return result;
|