Monday, 15 August 2011

How do I find the exception type of an exception that gets thrown in C#? -


I am using a library that does not document exceptions. This library is used to communicate with the company's product. I want to be able to differentiate between the exceptions that throw, but I do not know the names of exceptions (for example, between the time period or the under-voltage status of communication).

Use all of their examples only Hold (Exception) What do I need to use to get rid of personal errors, how do I get it? When I do ex.toString () I get something like this:

  System Option: C: \ users \ adam.siembida \ Desktop \ copley_cmo_test \ copley_cmo_test \ MainWindow.xaml.cs: line 41 (time object at CMLCOMLib.EcatObj.Initialize) at copley_cmo_test.MainWindow.btnConnect_Click (Object Sender, Routing Avenger, ARG)  

this:

  System.Exception: timeout   

It shows that they are just throwing a bare System.Exception , for example

  if (we Haveno API Design Skills) {New Exception ("Timeout"); }   

It is possible that such some exceptions that are designed better, but that which you have been shown is not a promise: (

always is a bad idea) you are trapped. Is it possible to ask the authors of the library whether they can improve matters for future releases.

No comments:

Post a Comment