473,412 Members | 2,994 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,412 software developers and data experts.

Exceptions thrown in includes not caught

Hello.

I've got IIS5, both at work and in my home, and I use JScript as the primary
scripting language in ASP.

When a function is defined in an included file, say

inc_dosth.asp:
<SCRIPT runat=server language=JScript>
function DoSth () {
throw new Error(0xFFFFFFFF);
}
</SCRIPT>

and called from within the ASP page body, say

test.asp:
<%@ LANGUAGE=JScript %>
<!-- #include file="inc_dosth.asp" -->
<%
try {
DoSth();
} catch (e) {Response.Write(e.description);}
%>

the try...catch clause should catch the exception. At my computer in my work
(Win2000 SP3, many Windows Update patches) this really works as expected.
However at home (Win2000 SP2, now SP4 (yes, SP4), no Windows Update
patches), these execeptions are caught by IIS and reported as unhandled
exceptions. On the exactly same code.

I hoped that the SP4 would repair the bug, but it haven't. What IIS patch do
I have to apply to get it working correctly at home too?

Thanks,
Martin.

Jul 19 '05 #1
9 2085

"Martin Plechsmid" <MPlechsmid.remove_to@send_mail.merlin.cz> wrote in
message news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello.
fuck knows,

but have you tried using a try catch with a different object and see if it
catches those exceptions?

then we will know if it is the object or for some reason try catch dont
work.

thats a start

I've got IIS5, both at work and in my home, and I use JScript as the primary scripting language in ASP.

When a function is defined in an included file, say

inc_dosth.asp:
<SCRIPT runat=server language=JScript>
function DoSth () {
throw new Error(0xFFFFFFFF);
}
</SCRIPT>

and called from within the ASP page body, say

test.asp:
<%@ LANGUAGE=JScript %>
<!-- #include file="inc_dosth.asp" -->
<%
try {
DoSth();
} catch (e) {Response.Write(e.description);}
%>

the try...catch clause should catch the exception. At my computer in my work (Win2000 SP3, many Windows Update patches) this really works as expected.
However at home (Win2000 SP2, now SP4 (yes, SP4), no Windows Update
patches), these execeptions are caught by IIS and reported as unhandled
exceptions. On the exactly same code.

I hoped that the SP4 would repair the bug, but it haven't. What IIS patch do I have to apply to get it working correctly at home too?

Thanks,
Martin.




Jul 19 '05 #2
I don't think that this problem is related to the order of execution. The
code in the includes contains function definitions only. It is surely
compiled, otherwise I wouldn't be able to execute the functions - and
nothing more than the compilation is needed.

Martin.
"Dave Anderson" <GT**********@spammotel.com> píše v diskusním příspěvku
news:e5**************@TK2MSFTNGP12.phx.gbl...
Drop the <SCRIPT> tags in the include, or suffer the order-of-execution
blues.
http://aspfaq.com/show.asp?id=2045
"Martin Plechsmid" wrote:

I've got IIS5, both at work and in my home, and I use JScript as the primary
scripting language in ASP.

When a function is defined in an included file, say

inc_dosth.asp:
<SCRIPT runat=server language=JScript>
function DoSth () {
throw new Error(0xFFFFFFFF);
}
</SCRIPT>

and called from within the ASP page body, say

test.asp:
<%@ LANGUAGE=JScript %>
<!-- #include file="inc_dosth.asp" -->
<%
try {
DoSth();
} catch (e) {Response.Write(e.description);}
%>

the try...catch clause should catch the exception. At my computer in my

work
(Win2000 SP3, many Windows Update patches) this really works as expected. However at home (Win2000 SP2, now SP4 (yes, SP4), no Windows Update
patches), these execeptions are caught by IIS and reported as unhandled
exceptions. On the exactly same code.

I hoped that the SP4 would repair the bug, but it haven't. What IIS

patch do
I have to apply to get it working correctly at home too?

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message.

Use of this email address implies consent to these terms. Please do not contact me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.

Jul 19 '05 #3
"Martin Plechsmid" wrote:

I don't think that this problem is related to the order of
execution.


You don't think so? Have you tried verifying it?
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #4
> You don't think so? Have you tried verifying it?

The code below writes CYZBAX, as expected. There's nothing mysterious about
the execution order in ASP pages:
1. everything is included and compiled
2. code in <%...%> is executed in the definition order
3. code in <SCRIPT>...</SCRIPT> is executed in the definition order.
(In global.asa, the order is similar, only <%...%> are prohibitted.)

test.asp:
<%@ LANGUAGE=JScript LCID=1029 %>
<!-- #include file="inc_test.asp" -->
<SCRIPT LANGUAGE="JScript" RUNAT=Server>
Response.Write("X");

function DoY () {
Response.Write("Y");
}
</SCRIPT>
<%
Response.Write("Z");
DoB();
%>

inc_test.asp:
<SCRIPT LANGUAGE="JScript" RUNAT=Server>
Response.Write("A");

function DoB () {
Response.Write("B");
}
</SCRIPT>
<%
Response.Write("C");
DoY();
%>

I still don't see, how this could be related to try...catch. Can you be more
precise?

Martin.

Jul 19 '05 #5
So you're saying you have not verified it. I guess there's no point in
making a suggestion if you'll disregard it without trying it out.

FWIW, you're throwing an error, but not a description. What happens when you
use the following?

throw new Error(0xFFFFFFFF,"This is an error")

Any different?

"Martin Plechsmid" wrote:
You don't think so? Have you tried verifying it?
The code below writes CYZBAX, as expected. There's nothing mysterious

about the execution order in ASP pages:
1. everything is included and compiled
2. code in <%...%> is executed in the definition order
3. code in <SCRIPT>...</SCRIPT> is executed in the definition order.
(In global.asa, the order is similar, only <%...%> are prohibitted.)

test.asp:
<%@ LANGUAGE=JScript LCID=1029 %>
<!-- #include file="inc_test.asp" -->
<SCRIPT LANGUAGE="JScript" RUNAT=Server>
Response.Write("X");

function DoY () {
Response.Write("Y");
}
</SCRIPT>
<%
Response.Write("Z");
DoB();
%>

inc_test.asp:
<SCRIPT LANGUAGE="JScript" RUNAT=Server>
Response.Write("A");

function DoB () {
Response.Write("B");
}
</SCRIPT>
<%
Response.Write("C");
DoY();
%>

I still don't see, how this could be related to try...catch. Can you be more precise?


Will it matter? You don't seem willing to try it out anyway.
--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Jul 19 '05 #6
> So you're saying you have not verified it. I guess there's no point in
making a suggestion if you'll disregard it without trying it out.
I have verified it, CYZBAX is the magic word both at work and at home.
FWIW, you're throwing an error, but not a description. What happens when you use the following?

throw new Error(0xFFFFFFFF,"This is an error")

Any different?


Still the same.

Thanks,

Martin.

Jul 19 '05 #7

There's one difference betwwen the machines: at work I use IE6, at home IE5,
but this is the difference I'd like to keep (for SW testing purposes). What
does IE and IIS have in common? The scripting engine. Maybe upgrading the
scripting engine would help, but this would be almost the same as upgrading
the IE. I'll try to make a save point, try it and roll back.

Any other idea that would influence IIS only?

Martin.

Jul 19 '05 #8
Installing the latest scripting engine (v.5.6) solved the problem.

Martin.
Jul 19 '05 #9
Martin Plechsmid wrote on 07 jul 2003 in
microsoft.public.inetserver.asp.general:
I've got IIS5, both at work and in my home, and I use JScript as the
primary scripting language in ASP.

When a function is defined in an included file, say

inc_dosth.asp:
<SCRIPT runat=server language=JScript>
function DoSth () {
throw new Error(0xFFFFFFFF);
}
</SCRIPT>

and called from within the ASP page body, say

test.asp:
<%@ LANGUAGE=JScript %>
<!-- #include file="inc_dosth.asp" -->
<%
try {
DoSth();
} catch (e) {Response.Write(e.description);}
%>


This works when you change:

throw new Error(0xFFFFFFFF);

to

throw "MyError";

and

Response.Write(e.description)

to

Response.Write(e)
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

24
by: mag31 | last post by:
Is there any way to find out if a particular .net function will throw an exception without first generating the exception? I am using structured exception handling i.e. try catch finally blocks...
9
by: Bernard | last post by:
Hi All, I am not sure if I should be asking this question on clc or clc++. Let me try on both. I hope that this is not too trivial for the brilliant minds over here. I know that OOP questions...
10
by: Jakob Bieling | last post by:
Hi, somehow the prejudice of exceptions being rather slow (compared to, ie. returning an error value and checking that) keeps sticking around .. at least around me. I guess this is also why I...
22
by: Drew | last post by:
How do I know which exceptions are thrown by certain methods? For example, reading a file might throw an IO Exception, etc. In Java, the compiler won't even let you compile unless you put your...
5
by: Miyra | last post by:
Hi. I'm working with an app that uses exceptions for control flow. These are code blocks where exceptions are thrown/caught regularly. A couple hundred exceptions occur per hour and they're caught...
3
by: Robert Rotstein | last post by:
It appears that exception handling at the top-most level of a C# program, in the static void Main() method, differs depending on whether the program is run in debug mode or not. That is, code such...
1
by: Anonieko | last post by:
Understanding and Using Exceptions (this is a really long post...only read it if you (a) don't know what try/catch is OR (b) actually write catch(Exception ex) or catch{ }) The first thing I...
7
by: akennis | last post by:
First of all, sorry for duplicating this post. I put it up in the alt.comp.lang.learn.c-c++ mistakenly. I'm investigating a problem whereby exceptions thrown from functions in a Shared Library...
5
by: Simon Tamman | last post by:
I have an object named DisasterRecovery. The Ctor of this object is this: private DisasterRecovery() { Application.ThreadException+= new...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.