|
Mailing Lists
|
Home /
Groups /
Ajax
Handling of ColdFusion error?
Author: Todd Kingham
Short Link: http://www.houseoffusion.com/groups/ajax/thread.cfm/threadid:685#2124
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
Author: Jim Davis
Short Link: http://www.houseoffusion.com/groups/ajax/thread.cfm/threadid:685#1981
> 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?
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: James Holmes
Short Link: http://www.houseoffusion.com/groups/ajax/thread.cfm/threadid:685#1976
[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: Charlie Arehart
Short Link: http://www.houseoffusion.com/groups/ajax/thread.cfm/threadid:685#1975
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/
----- Excess quoted text cut - see Original Post for more -----
Author: Jeff D. Chastain
Short Link: http://www.houseoffusion.com/groups/ajax/thread.cfm/threadid:685#1974
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
> 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: James Holmes
Short Link: http://www.houseoffusion.com/groups/ajax/thread.cfm/threadid:685#1973
Are you using CFAJAX or another framework?
If CFAJAX, http://jr-holmes.coldfusionjournal.com/cf_errors_in_cfajax.htm
> 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
Short Link: http://www.houseoffusion.com/groups/ajax/thread.cfm/threadid:685#1970
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
|
May 16, 2012
|
Latest Fusion Authority Articles
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||