472,357 Members | 2,015 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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 1162

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

Similar topics

4
by: Bill Cousert | last post by:
I have a Windows Form that uses the Microsoft WebBrowser control. If I load an HTML file into the control that contains Jscript code, can the Jscript code call a C# function in my Windows Form? ...
39
by: tydbowl | last post by:
I have a problem where the below code chunk causes handle leaks on some machines. The leak APPEARS to be handles to the registry key: HKCU\Software\Microsoft\Windows\CurrentVersion\Internet...
102
by: Xah Lee | last post by:
i had the pleasure to read the PHP's manual today. http://www.php.net/manual/en/ although Pretty Home Page is another criminal hack of the unix lineage, but if we are here to judge the quality...
7
by: VK | last post by:
Something *big* is cooking: the entire Microsoft JScript section is down: <http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jslrfjscriptlanguagereference.asp> ...
14
by: Xah Lee | last post by:
sometimes in the last few months, apparently Microsoft made changes to their JavaScript documentation website: ...
2
by: Eric Lilja | last post by:
Hello, consider this complete program: #include <iostream> #include <string> using std::cout; using std::endl; using std::string; class Hanna {
2
by: namewitheldbyrequest | last post by:
I created a web service that includes the statement: using Microsoft.JScript; so I can use the eval methods. The Web Service won't build: Error 1 The type or namespace name 'JScript' does...
6
by: Giulio Petrucci | last post by:
Hi there, as I need to share a .NET context with a JavaScript context and I can't re-write Rhino in C# ;-) I'trying to understand something about the Microsoft.JScript namespace, but - really -...
13
by: VK | last post by:
04.01.07 Redmond, WA Today it was officially announced that Microsoft is planning to discontinue client-side JScript support effective 10.08.07 The engine will be blocked and removed on the...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
1
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
0
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

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.