473,699 Members | 2,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Handling exception for PrototypeJs AJAX Call

RamananKalirajan
608 Contributor
Hi guys, I am having a problem in Prototypejs AJAX, I am triggering the AJAX call and in the option i am using like the folowing code:

[HTML]new Ajax.Request(co nnection.url, {
method: (connection.met hod ? connection.meth od : 'post'),
on404: function(reques t){
alert("File Not Found Exception Occured ");
this.connection s.waitPop();
this.isProcessi ng = false;
this.processNex t();
}.bind(this),
onSuccess: function(transp ort) {
(connection.onS uccessHandler ? connection.onSu ccessHandler(tr ansport) : {});
}.bind(this),
onException: function(reques t,exception){
alert("Exceptio n Occured "+exception.mes sage);
this.connection s.waitPop();
this.isProcessi ng = false;
this.processNex t();
}.bind(this),
onComplete: function(){
alert("OnComple te");
this.connection s.waitPop();
this.isProcessi ng = false;
this.processNex t();
}.bind(this)
});[/HTML]

handler on404: has high priority. I made the AJAX call with URL which is not over there. The Exception handler onException is working but on404: is not working. Has anyone tried like this before.

Regards
Ramanan Kalirajan
Aug 6 '08 #1
5 2786
acoder
16,027 Recognized Expert Moderator MVP
Why not use onFailure? For more information on callbacks, see this page.
Aug 6 '08 #2
RamananKalirajan
608 Contributor
Hi Acoder, onFailure doesn't works for the FileNotFound Error. The hadler code in onException gets executed when I included my code with the onFailure case. Then I commented the onException handler and once again tried running my code. the thing is it is not working well. The onfailure handler is not invoked. Any suggestions

Regards
Ramanan Kalirajan
Aug 7 '08 #3
acoder
16,027 Recognized Expert Moderator MVP
onFailure won't be invoked if on404 is invoked. Is there an error?
Aug 7 '08 #4
RamananKalirajan
608 Contributor
See I am having the three handler altogether on404, onFailure, onException. I am giving an incorrect URL in the Ajax request. It's only invoking the onException Handler. Then I commented the onException handler and tried with the other two I got nothing. None of the handler is invoked. I placed on404 handler alone and tried with variable parameter type and then onFailur handler alone with variable parameter type. Nothing got invoked i don't know why. Any suggestions.

Regards
Ramanan Kalirajan
Aug 7 '08 #5
acoder
16,027 Recognized Expert Moderator MVP
Make a simple function that just alerts the status or something and attach that to on404 instead just to test.
Aug 7 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

9
3201
by: Hans-Joachim Widmaier | last post by:
Hi all. Handling files is an extremely frequent task in programming, so most programming languages have an abstraction of the basic files offered by the underlying operating system. This is indeed also true for our language of choice, Python. Its file type allows some extraordinary convenient access like: for line in open("blah"): handle_line(line)
34
2220
by: rawCoder | last post by:
I have read that Exception Handling is expensive performance wise ( other than Throw ) , but exactly how ? Please consider the following example ... ////////////////// Code Block 1 ////////////////////////////////// Try { for ( ... ){// Code that might throw exception} }catch(...){} //////////////////////////////////////////////////////////////////////////
4
7611
by: James Radke | last post by:
Hello, I am looking for guidance on best practices to incorporate effective and complete error handling in an application written in VB.NET. If I have the following function in a class module (note that this class module represents the business layer of code NOT the gui layer): Public Function Test(ByVal Parm1 As Integer, ByVal Parm2 As Integer) As SqlDataReader ' Declare the SQL data layer class Dim oSQL As New...
1
3028
by: metsys | last post by:
We have an ASP.NET 2.0 (C#) application that is divided into multiple layers. The multiple layers come from having a web project and 2 different class library projects in the same solution. I'm having difficulties figuring out the best way to handle (catch) exceptions in the different layers and then propagating those errors back up through the call stack to ultimately display something to the end-user. Note this is an intranet...
35
3780
by: jeffc226 | last post by:
I'm interested in an idiom for handling errors in functions without using traditional nested ifs, because I think that can be very awkward and difficult to maintain, when the number of error checks gets about 3 or so. It also gets very awkward in nested loops, where you want to check for normal loop processing in the loop condition, not errors. Yes, you could put some generic exit flag in the loop condition, but when you're simply done if...
1
2021
by: Ami | last post by:
We have an application where in SOAP is used as a middle layer to communication between Java Front layer and DCE( Distributed Computing Env) backend layer. We are using Systinet Server for C++ to deploy our SOAP code and we make DCE RPC call through our SOAP code in C++ to connect and SEND and Retrieve Data from DCE. Now we have to incorporate exception handling in such a way , if DCE is down, then while making a DCERPC call SOAP Server...
1
3107
by: George2 | last post by:
Hello everyone, Such code segment is used to check whether function call or exception- handling mechanism runs out of memory first (written by Bjarne), void perverted() { try{
35
3504
by: eliben | last post by:
Python provides a quite good and feature-complete exception handling mechanism for its programmers. This is good. But exceptions, like any complex construct, are difficult to use correctly, especially as programs get large. Most of the issues of exceptions are not specific to Python, but I sometimes feel that Python makes them more acute because of the free-n- easy manner in which it employs exceptions for its own uses and allows users...
16
5054
by: john6630 | last post by:
Coming from the .Net world, I am used to the try...catch...finally approach to error handling. And PHP 5 now supports this approach. But I am not clear what happens to unhandled errors/exceptioins? Do I define a default error handler as well as do my try/catch? Can I mix error handling with the exceptions? Is one approach better than the other? TIA John
0
8685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8613
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8908
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7745
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6532
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4374
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.