469,934 Members | 2,642 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

catching Microsoft.JScript.JScriptException

bB
I am calling an external dll (compiled JScript) from within a
try/catch/finally block in a C# program and am unable to catch exceptions
being raised in the JScript dll by having a specific 'JScriptExcepton' catch
block. I can't work out why this is.

If I have a general catch block that catches exceptions of type 'Exception'
and print out the type of the exception, it correctly states that the type
is 'Microsoft.JScript.JScriptException'.

I have worked around the problem by doing a string comparison as follows:

catch (Exception ex)
{
hasErrors = true;

errorString +=
"An unexpected error has been encountered\n" +
"whilst processing the entry for '" +

productPackageItem["Description"] + "':\n\n";

//For some reason, exceptions of type "Microsoft.JScript.JScriptException"
//are not being caught with a seperate catch handler, and a comparison
using
//ex.GetType() against this exception class are also not working. A string
//comparison seems to be the only way of differentiated it...

if (ex.GetType().ToString() == "Microsoft.JScript.JScriptException")
{
errorString += "There is an error in the dimension formula\n\n";
}

errorString += "\"" + ex.Message + "\"";
}

What am I missing?

Tim.
Nov 15 '05 #1
0 1110

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Bill Cousert | last post: by
39 posts views Thread by tydbowl | last post: by
7 posts views Thread by VK | last post: by
2 posts views Thread by Eric Lilja | last post: by
2 posts views Thread by namewitheldbyrequest | last post: by
6 posts views Thread by Giulio Petrucci | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.