Monday, August 10, 2009

Quick Ajax Debugging Tip


Quick Ajax Debugging Tip
Ok, so this has been bugging me for the past few hours so I thought I'd share a quick hack. I've got a prototype I'm working on for a client that has a bit of Ajax in it. My Application.cfc code comes from a snippet I have in ColdFusion Builder and has the following onError:

Short and simple. An ugly dump is fine for testing. However, when an Ajax called was made, Firebug displayed a butt load of HTML (the dump) and it was difficult to find the exact message. I just changed it to the following code and it was incredibly helpful. Still not something I'd recommend on production, but I may change my snippet to support this:
message=#arguments.exception.message# detail=#arguments.exception.detail#
Basically, if method exists in the URL, assume it's Ajax. (I could also check the headers, as described here.)

No comments: