[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 257
  • Last Modified:

catch block

Will both exceptions fire if the exception raised is a COMException, or will just the COMException fire and ignore the general Exception?

try
{
...
...
}
catch(COMException eeee)
                  {
                        genFuncs.SendMessage("tom@thebuyersfund.com","Problem in BFFaxCOM method LoopThroughGiftLetterBookmarks","EntryID:  " + this.FAXCOM_ENTRYID + "\n\n\nERROR MESSAGE FOLLOWS:  " + eeee.ToString());
                        genFuncs.SendMessage("jasons@thebuyersfund.com","Problem in BFFaxCOM method LoopThroughGiftLetterBookmarks","EntryID:  " + this.FAXCOM_ENTRYID + "\n\n\nERROR MESSAGE FOLLOWS:  " + eeee.ToString());
                  }
                  catch(Exception eee)
                  {
                        genFuncs.SendMessage("tom@thebuyersfund.com","Problem in BFFaxCOM method LoopThroughGiftLetterBookmarks","EntryID:  " + this.FAXCOM_ENTRYID + "\n\n\nERROR MESSAGE FOLLOWS:  " + eee.ToString());
                        genFuncs.SendMessage("jasons@thebuyersfund.com","Problem in BFFaxCOM method LoopThroughGiftLetterBookmarks","EntryID:  " + this.FAXCOM_ENTRYID + "\n\n\nERROR MESSAGE FOLLOWS:  " + eee.ToString());
                  }
0
Tom Knowlton
Asked:
Tom Knowlton
  • 2
  • 2
1 Solution
 
udo_borkowskiCommented:
Only the "most concrete" exception will be handle. So in your case the catch (COMExeception...) block when a COMException (or any "subclass" of COMException) is thrown. Any other Exception will be handled by the catch(Exception...) block.
0
 
sachiekCommented:
Surely only COMException.


Sachi
0
 
Tom KnowltonWeb developerAuthor Commented:
??? only COMException will fire?
0
 
sachiekCommented:
YES Only COM Exception will be invoked.

Sachi
0
 
udo_borkowskiCommented:
>  ??? only COMException will fire?

Yes. If you have doubts, just give a try and raise a COMException in your try block and see what happens.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now