注销 MobileFirst 调用过程的 onFailure 错误详细信息

Logout MobileFirst invoke procedure' onFailure error details

我们能不能只捕获适配器调用失败的错误详细信息?示例代码:

var invocationData = {
    adapter : 'UploadAdapter',
    procedure : 'uploadImage',
    parameters : [uuid, base64Str]
};

WL.Client.invokeProcedure(invocationData, {
    onSuccess : uploadImageSuccess,
    onFailure : uploadImageFail,
    timeout   : 60000,
});

我已经试过了:

function uploadImageFail(result){
    WL.Logger.debug(JSON.stringify(result);
}

但它只是:

{"invocationContext":null}

我的情况:我正在开发一个图像上传适配器(通过 cordova),有时上传可能会失败。后端服务返回的错误信息(在uploadImageSuccess函数中处理)我可以很容易的捕捉到,但是当调用过程出错时,很难检索到错误日志。

我不确定您是否需要 JSON.stringify 它 result 对象。相反,您可能只想使用 result.errorMsg.

我也用谷歌搜索了一下,它产生了需要使用的代码的结果...所以我会尝试以下文章中提供的选项: