Zen exception js syntax error

1,074 views
Skip to first unread message

Dawn Wolthuis

unread,
Sep 28, 2009, 10:39:29 PM9/28/09
to InterSystems: Zen Community
I am getting a Zen exception for a javascript error and would like to
see the stack trace, but only see the dialog box. Since this is a js
error that occurs only in IE (seemingly related to something we are
doing onload) we cannot use firebug and so far I haven't gotten
anything from the IE 8 developer tools. Nothing shows up in any log
files I know how to look at, but I would think that these Zen
exceptions likely get logged somewhere I have not yet found. Is there
some way to find the full error message behind a Zen exception for a
javascript error? Thanks. --dawn

--
Dawn M. Wolthuis

Take and give some delight today

Dawn Wolthuis

unread,
Sep 30, 2009, 12:14:10 PM9/30/09
to InterSystems: Zen Community
The Zen exception message is below. I ran our external js through
jslint and cleaned up even the most anal of the errors listed there,
so I suspect it is in a Zen javascript clientmethod somewhere.

Does anyone have a guess what to look at for this IE-but-not-FF onload
Zen exception? Is there some way to see the full stack trace?

I do unit tests with just FF and then occasionally go and test
everything in IE 6-8, Chrome, Safari, and Opera too (I'm sure I could
add some, but that's the list at this point). So I did not catch this
until there had been many changes, making it more difficult to zero in
on the culprit.

I've exhausted the tools I know for debugging, including good old
alert statements, writing stuff to files, etc, but have not used any
debugger in IE nor am I getting any useful information from the IE 8
developer tool. Any and all suggestions or clues would be much
appreciated. Thanks. --dawn

ZEN EXCEPTION
http://dev.snupnow.com/csp/adev/MakePosting.StartPage.cls

A JavaScript exception was caught in function function zenPageEventHandler
SyntaxError: Syntax error
==============================
Error in zenPageEventHandler:onload
evt:undefined
=================================
Stack trace:
js:function zenExceptionHandler([objectError],[object Object],Error in
zenPageEventHandler:o...)
js:function zenPageEventHandler(onload)
js:function onload()

Vlado

unread,
Sep 30, 2009, 12:50:08 PM9/30/09
to InterSystems: Zen Community
Hi Dawn,
I think there is not operator zenSet in Zen.
It must be zenSetProp.

zenSet('mysignupsTable', 'hidden', true);
zenSet('tablenav1', 'hidden', true);
zenSet('buttonFormLabel','value','You have no current nor
upcoming sign-ups');
} else
{
zenSet('mysignupsTable', 'hidden', false);
zenSet('tablenav1', 'hidden', false);



On Sep 30, 9:14 am, Dawn Wolthuis <dw...@tincat-group.com> wrote:
> The Zen exception message is below. I ran our external js through
> jslint and cleaned up even the most anal of the errors listed there,
> so I suspect it is in a Zen javascript clientmethod somewhere.
>
> Does anyone have a guess what to look at for this IE-but-not-FF onload
> Zen exception? Is there some way to see the full stack trace?
>
> I do unit tests with just FF and then occasionally go and test
> everything in IE 6-8, Chrome, Safari, and Opera too (I'm sure I could
> add some, but that's the list at this point). So I did not catch this
> until there had been many changes, making it more difficult to zero in
> on the culprit.
>
> I've exhausted the tools I know for debugging, including good old
> alert statements, writing stuff to files, etc, but have not used any
> debugger in IE nor am I getting any useful information from the IE 8
> developer tool. Any and all suggestions or clues would be much
> appreciated.  Thanks.  --dawn
>
> ZEN EXCEPTIONhttp://dev.snupnow.com/csp/adev/MakePosting.StartPage.cls

Dawn Wolthuis

unread,
Sep 30, 2009, 12:57:30 PM9/30/09
to intersys...@googlegroups.com
Hi Vlado -- I don't even see where you are seeing the zenSet, but we
have it defined like this

function zenSet(id,prop,value)
{
return zenPage.getComponentById(id).setProperty(prop,value);
}

I searched to see where this might be a problem and I'm not seeing it.
I do not see zenSet in this Zen exception, do you?

thanks. --dawn

Vlado

unread,
Sep 30, 2009, 1:10:49 PM9/30/09
to InterSystems: Zen Community
function MySignUps_StartPage_onloadHandler() {
zenPage.addTableMouseOver();

table = zen('mysignupsTable');
var rowcount=table.getProperty('rowCount');
if (rowcount == 0)
{
zenSet('mysignupsTable', 'hidden', true);
zenSet('tablenav1', 'hidden', true);
zenSet('buttonFormLabel','value','You have no current nor
upcoming sign-ups');
} else
{
zenSet('mysignupsTable', 'hidden', false);
zenSet('tablenav1', 'hidden', false);
}
return
}

Maybe because this is in onloadHandler the function is still not
defined yet.
Just change it and test it.

Dawn Wolthuis

unread,
Sep 30, 2009, 3:18:27 PM9/30/09
to intersys...@googlegroups.com
Changed and tested it, but that was not the problem. It does seem to
be a problem, however, so I made the changes. Thanks for the tip.

I also found the problem, which was related to highlighting a row in a
table onmouseover since css hover does not work in IE. For the record,
I added the test for the id === '' in the below code snippet and
things are working again.

for (j=0;j<trs.length;j++)
{
var id = trs[j].getAttribute('id');
if (id === '')
{
break;
}
trs[j].onmouseover = new
Function("AddClassName("+id+",'hover',true)");
trs[j].onmouseout = new Function("RemoveClassName("+id+",'hover')");
}

I am still missing some tools/brains on how to debug something like
this or even see the offending zenSet. I'm doing too much debugging by
inspection. So, how did you find the zenSet issue? I could use some
"teach a man to fish" help. Thanks. --dawn

Vlado

unread,
Sep 30, 2009, 3:55:51 PM9/30/09
to InterSystems: Zen Community
Dawn,
Probably I will disappoint you, but I don’t
use any debugging tools. I use only the old primitive
Alert method which I move between the lines and localize
where could be the error.
In your case I didn’t have the source,
so I looked at the page source in the browser,
and found the zenSet accidentally.(excluding my
two decades experience in programming:)).

Dave

unread,
Sep 30, 2009, 5:01:21 PM9/30/09
to intersys...@googlegroups.com
If it seems like it's in an "onload"... and you're using external apache... There is code in some apache file somewhere that causes it to act differently if the web browser identifies as IE.  This was a problem when using SSL, and an interesting problem at that.  I don't remember if I ever managed to post about it here.  The problem was evasive until I used a Firefox plugin to make firefox identify itself as IE (with nothing else changed) and suddenly firefox was getting the same error... and then I found a plugin for IE that made it identify as Firefox, and suddenly IE was not getting an error.  Turned out to be a line of HTML inserted into the page by Apache when the browser is identified as IE.  This doesn't really sound like the same thing, but figured I'd throw it out there.

Dawn Wolthuis

unread,
Sep 30, 2009, 5:39:33 PM9/30/09
to intersys...@googlegroups.com
Thanks Vlado. Alert and, in the case of data models and
%OnAfterCreatePage, writing to a file/global is my primary tool too.
Thanks for picking up on that. I still have the problem that
sometimes a Zen exception seems to deprive us of the javascript stack
that might be ever so helpful. I would think that when wrapping the js
error with a Zen exception the stack trace is logged somewhere, but I
have not yet found that. Does anyone know how to get the actual stack
trace from a Zen exception that is due to a js error? Thanks.

--dawn

Dawn Wolthuis

unread,
Sep 30, 2009, 5:41:11 PM9/30/09
to intersys...@googlegroups.com
Thanks for the tidbit, Dave. IE gremlins seem to pop up in many places. --dawn

Derek Day

unread,
Sep 30, 2009, 6:32:09 PM9/30/09
to intersys...@googlegroups.com
I'd find the specific error and try to insert debugging code arouind that. There are a couple of places where we've added better error trapping that catches and returns the actual error rather than a statement that an error occured.
I would continue delving into the code, using alerts zenTrace or ZLM.cerr calls to log where have gotten to.

Ed and I found that if we accidentally refer to an undefined method in the onloadHandler that this evt undefined can be raised. We were investigating something else at the time, and havent circledback yet to see what is up.

So i would start by verifying that it is easy t reproduce this by having any syntax error and then just remove/add one line at a time till you figure out which line is causing this particular problem.

You also could and probably should use your own try catch and then dump the error if it occurs... I think there is a zenStackTrace function that you can use, though the standard Javascript error object may be enough.

HTH

-----Original Message-----
From: "Dawn Wolthuis" <dw...@tincat-group.com>
To: "intersys...@googlegroups.com" <intersys...@googlegroups.com>
Sent: 9/30/2009 6:06 PM
Subject: [InterSystems-Zen] Re: Zen exception js syntax error


Thanks Vlado. Alert and, in the case of data models and
%OnAfterCreatePage, writing to a file/global is my primary tool too.
Thanks for picking up on that. I still have the problem that
sometimes a Zen exception seems to deprive us of the javascript stack
that might be ever so helpful. I would think that when wrapping the js
error with a Zen exception the stack trace is logged somewhere, but I
have not yet found that. Does anyone know how to get the actual stack
trace from a Zen exception that is due to a js error? Thanks.

--dawn

Vlado

unread,
Sep 30, 2009, 6:50:33 PM9/30/09
to InterSystems: Zen Community
Let’s return to using the alert method.
The fastest way is dividing by 2.
You put the alert in the middle of method.
If the error appears before the alert it means
the error is in the first half of the method.
Then you put the alert in the middle of the first half and so on.

In your case the error says:

“Error in zenPageEventHandler:onload
evt:undefined “

So it is in onload method and something is undefined.

The onloadHandler method looks like
(in the source it could look a little bit different)

function MySignUps_StartPage_onloadHandler() {
zenPage.addTableMouseOver();
table = zen('mysignupsTable');
var rowcount=table.getProperty('rowCount');
if (rowcount == 0)
{
zenSet('mysignupsTable', 'hidden', true);
zenSet('tablenav1', 'hidden', true);
zenSet('buttonFormLabel','value','You have no current nor
upcoming sign-ups');
} else
{
zenSet('mysignupsTable', 'hidden', false);
zenSet('tablenav1', 'hidden', false);
}
return
}
The first thing I noticed was zenSet. When you fixed it
and the error appears again and because the rest of the method
looks OK it means that there is something wrong with

zenPage.addTableMouseOver();

To be sure you have to put alert before or after this line.
You can use also exclude method where it is possible. If you
remove or comment the line and the error doesn’t appear
It means that the error is in that line and you have to dig there.

Of course everything is easy especially when you know where
is the error.


On Sep 30, 2:41 pm, Dawn Wolthuis <dw...@tincat-group.com> wrote:
> Thanks for the tidbit, Dave. IE gremlins seem to pop up in many places.  --dawn
>
>
>
>
>
> On Wed, Sep 30, 2009 at 4:01 PM, Dave <xarm...@gmail.com> wrote:
> > If it seems like it's in an "onload"... and you're using external apache...
> > There is code in some apache file somewhere that causes it to act
> > differently if the web browser identifies as IE.  This was a problem when
> > using SSL, and an interesting problem at that.  I don't remember if I ever
> > managed to post about it here.  The problem was evasive until I used a
> > Firefox plugin to make firefox identify itself as IE (with nothing else
> > changed) and suddenly firefox was getting the same error... and then I found
> > a plugin for IE that made it identify as Firefox, and suddenly IE was not
> > getting an error.  Turned out to be a line of HTML inserted into the page by
> > Apache when the browser is identified as IE.  This doesn't really sound like
> > the same thing, but figured I'd throw it out there.
>

Dawn Wolthuis

unread,
Sep 30, 2009, 6:55:27 PM9/30/09
to intersys...@googlegroups.com
I've used alert many, many times, but in the case I was working on for
the longest, the error was in a super-super class and I was looking
the wrong direction for a while due to first looking at what had
recently changed. Gotta run, but thanks for the help. --dawn
Reply all
Reply to author
Forward
0 new messages