PDA

View Full Version : How to use FireBug to look at object?



dbassett74
9 Aug 2009, 7:30 AM
I'm struggling a bit with understanding how to look at various objects in FireBug. One such example is the Try Catch block. It passes back an "err" object. How do I see the err object's various properties in FireBug? I purposely caused an error to occur, but I can't figure out how to inspect it in FireBug. Any help would be appreciated.

Animal
9 Aug 2009, 7:47 AM
Use console.log() or console.dir() to output objects to the console log.

Seasnark
9 Aug 2009, 7:50 AM
Hi there,

I have just been learning these kind of things myself so I will give what limited knowledge I have figured out to date.

First, I am not sure if you are asking about seeing a backend or frontend exception. For the backend, it depends what mechanism you used to communicate the information back to the front (if at all). In my case, I captured the backend exception, popped it into a Json message and shipped that back to the front. I then decode the Json message and can inspect that. My decoding code is:


var serverResponse;
try {
serverResponse = Ext.decode(response.responseText);
}
catch(ex) {
this.showError(response.responseText);
return;
}The raw Json message is in response.responseText and so I can insepect both the message and the decoded result.

Fortunately this code snippet also shows a frontend JS try/catch, so in this case you sould be able to inspect ex in firefox to see what made this pop.

Hopefully you find this helpful. Happy hunting.

Animal
9 Aug 2009, 12:51 PM
It's thrown errors that are the problem.

Eveything else displays nicely in Firebug. Just exceptions need to be logged to the console to be able to see the call stack.