2012-02-13 35 views
0

这似乎是当我的Web服务发生错误时,onFailure方法未被调用。一个例子是如果该文件不在服务器上,则不会被调用。所以我的全部都有一个供用户按下的按钮。如果Web服务不存在,则不会发生任何事情。Enyo尝试检测Web服务何时不起作用

我假设我的程序有侦测这些错误的方法,所以我可以显示消息?????

代码片断 {名: “getHistory”,类型: “web服务”, 的onSuccess: “gotHistory”, onFailure处: “gotHistoryFailure”, 方法: “POST”, 网址:“HTTP://127.0 .0.1:8500/icechat /服务器/ loadhistory.cfm” },

///////////////////////////////////////////////////////////////////////////////// 
// Call back, called when the history data has been loaded from web services 
gotHistory: function(inSender, inResponse) { 

    // Convert data from server to a jason object 
    // NOTE: The string should be checked first for embeded javascrip code 

     this.serverReply2= inResponse; 
    this.$.list.render(); 
}, 

////////////////////////////////////////////////////////////////////////////////// 
// Called if the history data could not be loaded from the web service 
gotHistoryFailed: function() 
{ 
    alert("got infortion failed"); // this never goes off 
}, 
+0

如果您在webOS中作为应用程序运行,请知道alert()是无操作的 - 您需要其他一些机制,例如使用'enyo.log'来记录失败。 – 2012-04-13 19:22:15

回答

0

这是一个古老的问题,但以防万一别人有类似的问题: 一个问题下面是该功能被命名为gotHistoryFailed,种类定义有onFailure: gotHistoryFailure名称必须完全匹配,或者t他的处理程序将不会被调用。