mirror of
https://github.com/fluxscape/fluxscape.git
synced 2026-01-11 14:52:54 +01:00
fix: Cloud Function failure response (#93)
Error: undefined is not an object (evaluating 'e.error')
This commit is contained in:
@@ -3,6 +3,17 @@ const CloudStore = require('@noodl/runtime/src/api/cloudstore');
|
|||||||
|
|
||||||
('use strict');
|
('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) {
|
function _makeRequest(path, options) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
|
|
||||||
@@ -15,7 +26,9 @@ function _makeRequest(path, options) {
|
|||||||
|
|
||||||
if (xhr.status === 200 || xhr.status === 201) {
|
if (xhr.status === 200 || xhr.status === 201) {
|
||||||
options.success(json);
|
options.success(json);
|
||||||
} else options.error(json);
|
} else {
|
||||||
|
options.error(json);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -191,7 +204,7 @@ var CloudFunctionNode = {
|
|||||||
this.sendSignalOnOutput('success');
|
this.sendSignalOnOutput('success');
|
||||||
},
|
},
|
||||||
error: (e) => {
|
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 = {
|
this._internal.lastCallResult = {
|
||||||
status: 'failure',
|
status: 'failure',
|
||||||
error
|
error
|
||||||
|
|||||||
Reference in New Issue
Block a user