Handling of CF error?

View: New views
6 Messages — Rating Filter:   Alert me  

Handling of CF error?

by Jeff Chastain-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:47:1970
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/47
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:47
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.47
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: Handling of CF error?

by James Holmes-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...> 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?

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:47:1973
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/47
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:47
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.47
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

RE: Handling of CF error?

by Jeff Chastain-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Using CFAjax at this point.

Thanks.

-----Original Message-----
From: James Holmes [mailto:james.holmes@...]
Sent: Thursday, November 03, 2005 6:47 PM
To: Ajax
Subject: Re: Handling of CF error?

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@...> 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?



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:47:1974
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/47
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:47
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.47
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

RE: Handling of CF error?

by Charlie Arehart :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@...
www.newatlanta.com/bluedragon/

 

> -----Original Message-----
> From: Jeff D. Chastain [mailto:lists@...]
> Sent: Thursday, November 03, 2005 11:13 AM
> To: Ajax
> Subject: Handling of CF error?
>
> 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
>
>
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:47:1975
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/47
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:47
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.47
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Re: Handling of CF error?

by James Holmes-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 11/4/05, Charlie Arehart <charlie@...> 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.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:47:1976
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/47
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:47
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.47
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

RE: Handling of CF error?

by Jim Davis :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> -----Original Message-----
> From: Jeff D. Chastain [mailto:lists@...]
> Sent: Thursday, November 03, 2005 11:13 AM
> To: Ajax
> Subject: Handling of CF error?
>
> 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






~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:47:1981
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/47
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:47
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=17837.14401.47
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54