An onFailure
handler in webOS has an argument inError. I tried printing it using: console.log("error: " + inError);
, but the result is only: error: [object Object]*** (app/assistants/main-assistant.js:26)
, which isn't much use. How c开发者_如何学Goan I log something more useful instead?
Update:
Ares generates: alarm1Failure: function(inSender, inError) {}
. However, the error is contained as the errorText
property of the first object and the second object is the request
I would use the interactive debugger at:
http://ares.palm.com/AresDebug/
Connect your device and run your app. Put your app name in the 'Script Filter' box and click get scripts.
Now use the 'Available Scripts' pull down to find your assembly.
You can set breakpoints (click on line numbers to the left) and inspect variables using the lower left pane and '>' prompt.
Be sure to use Chrome or Safari as it will not work with IE.
There is also a logger at: http://ares.palm.com/AresLog/
if you don't want to use the debugger, then you probably should know something about the inError
object getting returned to you. In this case I assume the onFailure
comes from a Protocol function's callback, so try looking in the Protocol documentation to see what information the error object should contain.
Also for any logging purposes don't forget about the imensely useful function
JSON.stringify(obj)
It will take an object and return a JSON representation that you can log so you can see all the properties at once.
精彩评论