lucid-extension-sdk 0.0.127 → 0.0.128
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/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DataConnector = exports.DataConnectorRequestError = exports.DataConnectorRunError = void 0;
|
|
4
|
+
const checks_1 = require("../core/checks");
|
|
4
5
|
const action_1 = require("./actions/action");
|
|
5
6
|
const dataconnectoractionkeys_1 = require("./actions/dataconnectoractionkeys");
|
|
6
7
|
const managewebhookresponsebody_1 = require("./actions/managewebhookresponsebody");
|
|
@@ -100,12 +101,11 @@ class DataConnector {
|
|
|
100
101
|
}
|
|
101
102
|
catch (e) {
|
|
102
103
|
const errorLogger = console.error ? console.error : console.log;
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
errorLogger(`Error running ${actionName} action`, e);
|
|
105
|
+
if (isDataConnectorRunError(e)) {
|
|
105
106
|
return { status: e.status, body: e.body };
|
|
106
107
|
}
|
|
107
108
|
else {
|
|
108
|
-
errorLogger(`Error running ${actionName} action`, e);
|
|
109
109
|
return { status: 500, body: { error: `error running ${actionName} action` } };
|
|
110
110
|
}
|
|
111
111
|
}
|
|
@@ -122,3 +122,7 @@ class DataConnector {
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
exports.DataConnector = DataConnector;
|
|
125
|
+
// instanceof DataConnectorRunError will not work in some environments
|
|
126
|
+
function isDataConnectorRunError(e) {
|
|
127
|
+
return (0, checks_1.isObject)(e) && (0, checks_1.isNumber)(e.status) && e.hasOwnProperty('body');
|
|
128
|
+
}
|