fix: Cloud Function failure response (#93)

Error: undefined is not an object (evaluating 'e.error')
This commit is contained in:
Eric Tuvesson
2025-03-28 16:11:18 +01:00
committed by GitHub
parent 80c7c01805
commit 7ca69b809a

View File

@@ -3,6 +3,17 @@ const CloudStore = require('@noodl/runtime/src/api/cloudstore');
('use strict');
/**
* @param {string} path
* @param {{
* endpoint: string;
* method: string;
* appId: string;
* content: any;
* success: (json: object) => void;
* error: (json: object | undefined) => void;
* }} options
*/
function _makeRequest(path, options) {
var xhr = new XMLHttpRequest();
@@ -15,7 +26,9 @@ function _makeRequest(path, options) {
if (xhr.status === 200 || xhr.status === 201) {
options.success(json);
} else options.error(json);
} else {
options.error(json);
}
}
};
@@ -191,7 +204,7 @@ var CloudFunctionNode = {
this.sendSignalOnOutput('success');
},
error: (e) => {
const error = typeof e === 'string' ? e : e.error || 'Failed running cloud function.';
const error = typeof e === 'string' ? e : e?.error || 'Failed running cloud function.';
this._internal.lastCallResult = {
status: 'failure',
error