I agree with Kurt.  JQuery is looking at the HTTP status code of the
response.  By default we do not send a 500 HTTP status code because
sometimes people need to handle it differently. 

Just have your exception event-handler indicate the correct HTTP status
code.  You can use addHttpHeaderByStatusCode(500) in your view,
listener, filter or plugin.

Also, I usually have plugin that looks for the header that JQuery /
Prototype / etc. adds to all requests.  I use the preProcess plugin
point to set an event-arg like _requestType = "AJAX|standard".  You can
then use that in an exception event-handler to determine if the
exception should be sent back as HTML or as XML/JSON etc.

HTH,
.Peter

Kurt Wiersma said the following on 01/27/2011 02:25 PM:
> I think you are going to have to use cfheader somewhere to spit back
> to jquery an http response that indicates to jquery there was an
> error.
>
> --Kurt
>
> On Tue, Jan 25, 2011 at 9:42 AM, Andrew.Leaf <[email protected]> wrote:
>> I have put into place an error handler that works based on environment
>> like prod, qa, integration. Basically the qa and integration just
>> displays the default exception to the programmer when in dev and qa,
>> but in production we actually capture the error do some clean up of
>> the data store it for logging purpose, give the customer a form to
>> fill out so we can contact them for more information if necessary.
>>  The problem I am running up against is we have several pages making
>> jquery ajax calls and in some case all we are doing is returning html
>> to change the display on the screen. In some other cases we are
>> waiting for data to come back in json format, but if an error occurs.
>> In the current case is template timeouts.
>>
>>  JQuery considers the type of exception as a success, bucause it is
>> legit response so the jquery error handler never fires off. I am
>> looking for a solution when an ajax response fails we do not get a
>> template exception, but force the response to be handled by the jquery
>> error handler. I do not want to change the regular functionality of
>> the current error handler that is already in place.
>>
>> --
>> You received this message because you are subscribed to Mach-II for CFML 
>> list.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to 
>> [email protected]
>> For more options, visit this group at 
>> http://groups.google.com/group/mach-ii-for-coldfusion?hl=en
>>
>> SVN: http://svn.mach-ii.com/machii/
>> Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/
>>

-- 
You received this message because you are subscribed to Mach-II for CFML list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/mach-ii-for-coldfusion?hl=en

SVN: http://svn.mach-ii.com/machii/
Wiki / Documentation / Tickets: http://trac.mach-ii.com/machii/

Reply via email to