Haiti
Is there a way to uniquely identify specific exceptions from the general exception class?
To identify a particular property, any property or method that is to identify a particular exception.
I have put some error values and related error texts in an XML file. I want to read that XML file and I have to get the error ID and the relevant text has to be fixed in the label. System exception In case of we have to identify a particular exception.
use exception HResult .
'HRESULT is a 32-bit value, which is divided into three separate fields: a severity code, a feature code, and an error code. The severity code indicates whether the return value represents information, warning or error. The feature code identifies the area of the system responsible for the error. The error code is a unique number assigned to represent the exception. Each exception has been mapped to a different HRESULT if the managed code throws an exception, the Runtime COM client passes HRESULT when the unmanaged code returns an error, then HRESULT becomes an exception, which Then thrown by runtime '
Update: The HResult field is safe on the system. The option base class so you can not access it. Derived COM classes use Harscelt because it was the primary way of reporting errors under the COM, managed code did not use it.
I suggest creating an exception type in my own:
Public class MyExceptionWrapper: one reads on exceptions {// GUIDs and if possible, other Use one of the constructors to get the GUID {GUID GUIDE; Set; } // Create your exception type using the constructor from System.Exception // and then assign a GUID. Public MyExceptionWrapper (String Message, Exception Internal): Support (Message, Internal) {GUID = New Guide (); }} You can use this pattern to deal with error:
try {// error cause of error} (pre-exception) {MyExceptionHandlerMethod (New MyExceptionWrapper ("I An Error Reason", formerly)); // or - The new Myxation Warper to throw the stack ("I generated an error", formerly); }
Comments
Post a Comment