lucid-extension-sdk
Advanced tools
Comparing version 0.0.127 to 0.0.128
{ | ||
"name": "lucid-extension-sdk", | ||
"version": "0.0.127", | ||
"version": "0.0.128", | ||
"description": "Utility classes for writing Lucid Software editor extensions", | ||
@@ -5,0 +5,0 @@ "main": "sdk/index.js", |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DataConnector = exports.DataConnectorRequestError = exports.DataConnectorRunError = void 0; | ||
const checks_1 = require("../core/checks"); | ||
const action_1 = require("./actions/action"); | ||
@@ -103,8 +104,7 @@ const dataconnectoractionkeys_1 = require("./actions/dataconnectoractionkeys"); | ||
const errorLogger = console.error ? console.error : console.log; | ||
if (e instanceof DataConnectorRunError) { | ||
errorLogger(`Error running ${actionName} action`, e); | ||
errorLogger(`Error running ${actionName} action`, e); | ||
if (isDataConnectorRunError(e)) { | ||
return { status: e.status, body: e.body }; | ||
} | ||
else { | ||
errorLogger(`Error running ${actionName} action`, e); | ||
return { status: 500, body: { error: `error running ${actionName} action` } }; | ||
@@ -126,1 +126,5 @@ } | ||
exports.DataConnector = DataConnector; | ||
// instanceof DataConnectorRunError will not work in some environments | ||
function isDataConnectorRunError(e) { | ||
return (0, checks_1.isObject)(e) && (0, checks_1.isNumber)(e.status) && e.hasOwnProperty('body'); | ||
} |
528087
12090