View Single Post
Old 10-15-2007, 10:43 AM   #6 (permalink)
Karl
The Reckoner
Advanced Programmer Top Contributor 
 
Karl's Avatar
 
Join Date: Sep 2007
Posts: 437
Thanks: 22
Karl is on a distinguished road
Default

I dont think this is the cause, but you changed the order of execution near the throw statemenet. Here's what I originally posted:

Code:
 else if(transport.responseText == 2) {
			$('currentPassword').activate();
		    throw 'Your given password is incorrect';
		  }
Notice how we throw the exception after we call the .activate() method. We do this because as soon as we throw the exception we leave the method immediately after (no code after the throw statement is read).

As for the current issue, im not actually sure what is causing that. The try..catch should be working fine. If you'd like to test it, try ammending the checkPass function like so:

Code:
function checkPass(element) {
throw 'Test Alert';
That should throw a new exception as soon as we enter the checkPass function. If the alert shows, it is most likely a logic problem, i.e. neither the "if" or "else if" conditions are true.
__________________
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
Karl is offline  
Reply With Quote