473,386 Members | 1,821 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,386 software developers and data experts.

user defined exception not caught

hi,

I have a pluggin whiich throw an exception of the following user
defined exception:

public class SpellCheckException : ApplicationException
{
public SpellCheckException(string msg) : base(msg)
{
}

public SpellCheckException(string msg, Exception innerException) :
base(msg, innerException)
{
}

}

The following code in my exe(in the same directory level as my exe)
which loads the pluggin will not catch this exception in this catch
try statement, when the user defined user exception is thrown.

try
{

}
catch(SpellCheckException e)
{

}

Does anyone know why this is? When I use throw a normal system
'Exception' from the pluggin, a catch(Exception e) in my exe will
catch it properly. Know whats going on?

thx
-Philip
Nov 15 '05 #1
1 4355
Hi,

Are you sure you are throwing the exception properly ? (You have't
copy-pasted the code which throws that exception).
I've tried the following code, using your custom exception, and it worked
perfectly:

try
{
throw new SpellCheckException("my exception");
}
catch(SpellCheckException e)
{

MessageBox.Show(e.Message);
}

hi,

I have a pluggin whiich throw an exception of the following user
defined exception:

public class SpellCheckException : ApplicationException
{
public SpellCheckException(string msg) : base(msg)
{
}

public SpellCheckException(string msg, Exception innerException) :
base(msg, innerException)
{
}

}

The following code in my exe(in the same directory level as my exe)
which loads the pluggin will not catch this exception in this catch
try statement, when the user defined user exception is thrown.

try
{

}
catch(SpellCheckException e)
{

}

Does anyone know why this is? When I use throw a normal system
'Exception' from the pluggin, a catch(Exception e) in my exe will
catch it properly. Know whats going on?

thx
-Philip


Adrian Vinca [MSFT], Developer Division
--------------------------------------------------------------------
This reply is provided "AS IS", without warranty (express or implied).

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.

Nov 15 '05 #2

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

Similar topics

5
by: Jacek Dziedzic | last post by:
Hi! In my main() function I have a last-resort exception construct that looks like this: int main() { try { // ... program code }
10
by: jeff regoord | last post by:
A user inputs a float value. The scanf() function gets the value. However, I need to create an error handler with an if else statement saying invalid input if the input is not a number. Does...
1
by: Chris Fink | last post by:
I have written a c# windows application which is occasionally throwing this messagebox popup exception in the test environment: "application has generated an exception that could not be handled"...
4
by: vooose | last post by:
Is there any way to handle exceptions thrown by .NET classses? During runtime and at seemingly random times, exceptions similar to the ones shown at the base of this post are thrown. These errors...
40
by: Kevin Yu | last post by:
is it a bad programming design to throw exception in the try block then catch it??
6
by: Vadivel Kumar | last post by:
I've a problem in handling a custom exception The following is my custom exception class: public class AppException : public Exception { public AppException (string message, Exception...
9
by: Claudio Di Flumeri | last post by:
Hello all, I've added a global exception handler to my application in this way: Sub Main() AddHandler Application.ThreadException, AddressOf ThreadException AddHandler...
1
by: Michael R | last post by:
I am using a PrintPreviewDialog to show a document. Via the BeginPrint event, I open a PrintDialog to let the user choose what pages (and other settings) to print. However, I can't find a way to...
10
by: Rahul | last post by:
Hi Everyone, I have the following exception class, class E1 { }; class E2 {
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.