[object error]

H

Hansen

Hi!

I have a try/catch statement on my webpage, in which a create som html.
Sometimes this routine fails and the catch writes the error in an alert box.
My problem is that the only
thing the error says is [object error] even though I write all the
attributes in the Error object (name, number, description, message).
How can I inspect further what has gone wrong?

/Hansen
 
R

RobG

Hansen said:
Hi!

I have a try/catch statement on my webpage, in which a create som html.
Sometimes this routine fails and the catch writes the error in an alert box.
My problem is that the only
thing the error says is [object error] even though I write all the
attributes in the Error object (name, number, description, message).
How can I inspect further what has gone wrong?

Use a better browser/debugger. Firefox/Mozilla/Netscape + JavaScript
console tends to be better than IE - though on the odd occasion, IE
might be better.

JavaScript is generally not so complex that where errors might occur can
be reasonably easily detected. Try to create a minimal example that
displays the behaviour and post it here - you might find the solution in
the process.
 
H

Hansen

Use a better browser/debugger. Firefox/Mozilla/Netscape + JavaScript
console tends to be better than IE - though on the odd occasion, IE might
be better.

It's a IE only application
JavaScript is generally not so complex that where errors might occur can
be reasonably easily detected. Try to create a minimal example that
displays the behaviour and post it here - you might find the solution in
the process.

It is some very complex code. Showing just a small example wouldn't add to
the solution. But I have found out that inserting a small delay (by using
setTimeout) of 10 miliseconds, cures the problem. I'm just very currious to
find out what caused the problem in the first place, since I don't like
"wait a while" solutions. By using IE and VS 2003 I found out that the error
where caused by the following line:

// for inserting elements
function INTRINSICS_onclick(strHtml, id)
{
var element = editorFrame.DOM.getElementById(id); <-- Halts here
.....
The editorFrame object is a DHTML editor activeX component from MS which is
a part of IE. When the error occours the DOM doesn't contain the id, but I
don't see how this should cause an error since element should just become
null.

Could it be, that the editorFrame object hasn't been created yet or somehow
is unaccessible? But wouldn't that cause a "editorFrame is null or not an
object" error?

/Hansen
 
D

Dag Sunde

Hansen said:
It's a IE only application


It is some very complex code. Showing just a small example wouldn't
add to the solution. But I have found out that inserting a small
delay (by using setTimeout) of 10 miliseconds, cures the problem. I'm
just very currious to find out what caused the problem in the first
place, since I don't like "wait a while" solutions. By using IE and
VS 2003 I found out that the error where caused by the following line:

// for inserting elements
function INTRINSICS_onclick(strHtml, id)
{
var element = editorFrame.DOM.getElementById(id); <-- Halts
here .....
The editorFrame object is a DHTML editor activeX component from MS
which is a part of IE. When the error occours the DOM doesn't contain
the id, but I don't see how this should cause an error since element
should just become null.

Could it be, that the editorFrame object hasn't been created yet or
somehow is unaccessible? But wouldn't that cause a "editorFrame is
null or not an object" error?
No
the <object> element *is* loaded, so it isn't null or not an...

But the code loaded _by_ <object> isn't necessarily loaded yet
take a look at the object's readyState attribute...
 
H

Hansen

But the code loaded _by_ said:
take a look at the object's readyState attribute...

Even though the readyState is 4 (object is ready) I still get the error.
Seems as if I have to stick with the "wait-hack".

Thanks for the help

/Hansen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top