Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-30-2006, 11:09 AM   PM User | #1
Exodious
Regular Coder

 
Join Date: Jul 2002
Posts: 165
Thanks: 0
Thanked 0 Times in 0 Posts
Exodious is an unknown quantity at this point
Question Debugging [Error Object] in try/catch statement

Hi there,
I'm using ajax to send and receive data, and use cross-domain scripting, this works fine when you add the domain to your IE security settings/Intranet sites list, I want to be able to catch the message IE would normally give you: "This page is accessing information that is not under its control. This poses a security risk... etc... ", and display the message at a different time with a list of other things, I claim myself that I have a brain but cannot figure out for the life of me the properties on the error object caught in the catch statement, example:

Code:
try
{
      xmlHttpReq.open("POST", sURL, false);
}
catch(e)
{ 
     alert("error.toString(): " + e.toString());
     alert("error.id: " + e.id);
}
The .asString() returns [Object Error] which is great, but I cannot find any of the properties which give info about the actual error, I've tried .description/.message, the documentation I've found doesn't seem to help, am I viewing an IE error object or an object setup by the previous command e.g. xmlHttpReq.open ?

Thanks for help
Exodious is offline   Reply With Quote
Old 10-30-2006, 12:44 PM   PM User | #2
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
Do this:

Code:
for(prop in e){
  alert(e + ": " + e[prop]);
}
Eric
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:32 PM.


Advertisement
Log in to turn off these ads.