August 30, 2008
For ColdFusion hosting try HostMySite.com. |
Home /
Groups /
Ajax
Handling of ColdFusion error?
I am just beginning to look into AJAX, so bear with me if this is completelyJeff D. Chastain 11/03/05 11:16 A Are you using CFAJAX or another framework?James Holmes 11/03/05 07:49 P Using CFAjax at this point.Jeff D. Chastain 11/03/05 07:56 P Well, think about it: the ajax client code within the browser (typically anCharlie Arehart 11/03/05 11:30 P On 11/4/05, Charlie Arehart <charlie@newatlanta.com> wrote:James Holmes 11/04/05 03:54 A > -----Original Message-----Jim Davis 11/04/05 04:03 P I can't stress this enough.... If you are writing AJAX you NEEEEEED to get a good HTTP PacketTodd Kingham 12/18/05 02:23 P
Author: Jeff D. Chastain
I am just beginning to look into AJAX, so bear with me if this is completely obvious. If the CF function that is called via JS/AJAX throws an error, where does that error go? Is it possible to capture that error and bring it to the interface? Thanks -- Jeff
Author: James Holmes
Are you using CFAJAX or another framework? If CFAJAX, http://jr-holmes.coldfusionjournal.com/cf_errors_in_cfajax.htm On 11/4/05, Jeff D. Chastain <lists@admentus.com> wrote: > I am just beginning to look into AJAX, so bear with me if this is completely > obvious. If the CF function that is called via JS/AJAX throws an error, > where does that error go? Is it possible to capture that error and bring it > to the interface?
Author: Jeff D. Chastain
Using CFAjax at this point. Thanks. Are you using CFAJAX or another framework? If CFAJAX, http://jr-holmes.coldfusionjournal.com/cf_errors_in_cfajax.htm On 11/4/05, Jeff D. Chastain <lists@admentus.com> wrote: > I am just beginning to look into AJAX, so bear with me if this is > completely obvious. If the CF function that is called via JS/AJAX > throws an error, where does that error go? Is it possible to capture > that error and bring it to the interface?
Author: Charlie Arehart
Well, think about it: the ajax client code within the browser (typically an xmlhttprequest object) is talking to the server. It (the client code) is expecting some specifically formatted result (could be you wrote it to expect xml, or perhaps a simple value), but it's not likely expecting a bug hunk of HTML, right? But what will CF (or BlueDragon) return if an error occurs? It's HTML, right? (Of course, to us viewing the page in the browser it shows a nicely formatted error message, but if you think about it, it's HTML.) So you have two problems. You ask, "where does it go"? It goes back to the ajax client. It's just that unless you write the client to expect and process HTML, it will "seem to disappear" or "do nothing". It's just not getting what it expects. So how can you solve this, if you're using a client that you don't/can't control? Well, your CF logs will be one way to know what's going on (CF writes errors to its application.log file). You could also set up error handling, to do more on an error, like email you about it (classic CFML error handling stuff), and you could even write it to send something more meaningful to the ajax client. Hope that helps. Charlie Arehart CTO, New Atlanta Communications, makers of BlueDragon (678) 256-5395 charlie@newatlanta.com www.newatlanta.com/bluedragon/
Author: James Holmes
On 11/4/05, Charlie Arehart <charlie@newatlanta.com> wrote: [snip] > > So how can you solve this, if you're using a client that you don't/can't > control? Well, your CF logs will be one way to know what's going on (CF > writes errors to its application.log file). You could also set up error > handling, to do more on an error, like email you about it (classic CFML > error handling stuff), and you could even write it to send something more > meaningful to the ajax client. That's what my technique (for CFAJAX) does - it uses CF error handling to pass meaningful JS back to the browser via the CFAJAX engine.
Author: Jim Davis
> -----Original Message----- Sure - just as you can output HTML or whatever when an error occurs you can output XML in whatever dialect you're using and send that to the client. As a shameless plug I'll also say that this is REALLY simple in YODEL since the JavaScript deserializer easily allows for custom handlers. So your error might have a custom type of "error" and, on the client, you could have a custom handler for "error". This handler might throw an error to the client, recall a data fetcher, log it or whatever you like. You can find out more about YODEL here: http://www.depressedpress.com/Content/Development/YODEL/Index.cfm And get JavaScript and CF libraries for using it (both of which support custom handlers) here: http://www.depressedpress.com/Content/Development/YODEL/Implementations/Inde x.cfm Of course while it's easy in YODEL it's not really hard in anything else. But please use YODEL! ;^) Jim Davis
Author: Todd Kingham
I can't stress this enough.... If you are writing AJAX you NEEEEEED to get a good HTTP Packet Sniffer. It's like a crystal ball for your code ;) In reading through a ton of AJAX posts I never hear this topic come up, but for me it is an invaluable tool in AJAX development. Not only can you read the CF Errors when they come back but it gives you an insight into download times and bandwidth useage, etc..... There are a bunch out there but the best one I have used is from IE Inspector. It is awesome! But if you are not in the market for one you have to buy there are some free ones out there that work well. I have a list to several on my site at the following URL: http://www.lalabird.com/jsmx/?fa=JSMX. downloads HTH, Todd >I am just beginning to look into AJAX, so bear with me if this is completely >obvious. If the CF function that is called via JS/AJAX throws an error, >where does that error go? Is it possible to capture that error and bring it >to the interface? > >Thanks >-- Jeff
|
Mailing Lists
|
Latest Fusion Authority Articles
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||