2016-01-08 16 views
0

我们能否抓住适配器调用失败的错误细节?示例代码:注销MobileFirst invoke procedure'on失败错误详情

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} 

我的情况:我工作的图片上传适配器上(通过科尔多瓦),有时上传可能会失败。我可以很容易地捕获从后端服务(在uploadImageSuccess函数中处理)返回的错误消息,但在调用过程出错时检索错误日志并不容易。

回答

0

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

我也用Google搜索,并制作了一个需要使用的代码的结果......所以我会尝试在下面的文章中提供的选项:

+0

'result.errorMsg'工作,哪个是'运行时:Http请求失败:java.net.SocketTimeoutException:读取超时'。由于我们将图像编码为base64字符串(可能很长),因此在调用上传适配器时经常发生此错误。 –