Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 793563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:10:22+00:00 2026-05-14T22:10:22+00:00

Hiii. Is there any way to uniquely identify a particular exception from the general

  • 0

Hiii.

Is there any way to uniquely identify a particular exception from the general exception class.

i.e any property or method that retrieves a unique identifier that to identify a particular exception.

I have kept some error values and corresponding error texts in an xml file. I want to read that xml file and have to taken the error ids and fix the corresponding texts to a label. in the case of a system exception we have to identify a particular exception.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:10:23+00:00Added an answer on May 14, 2026 at 10:10 pm

    Use Exception.HResult.

    ‘
    HRESULT is a 32-bit value, divided into three different fields: a severity code, a facility code, and an error code. The severity code indicates whether the return value represents information, warning, or error. The facility code identifies the area of the system responsible for the error. The error code is a unique number that is assigned to represent the exception. Each exception is mapped to a distinct HRESULT. When managed code throws an exception, the runtime passes the HRESULT to the COM client. When unmanaged code returns an error, the HRESULT is converted to an exception, which is then thrown by the runtime.
    ‘

    From http://msdn.microsoft.com/en-us/library/system.exception.hresult%28v=VS.100%29.aspx

    UPDATE: the HResult field is protected on the System.Exception base class so you cannot access it. Derived COM classes make use of HResult as it was the primary way to report errors under COM, managed code does not use it.

    I would suggest creating your own Exception type which contains a GUID:

        public class MyExceptionWrapper : Exception
        {
          //Have a read on GUIDs and use one of the other constructors if possible.
            public Guid GUID { get; set; } 
          //Construct your Exception type using the constructor from System.Exception 
          // and then assign the GUID.
            public MyExceptionWrapper(string message, Exception inner) : 
                base(message, inner)
            {
                GUID = new Guid();
            }
        }
    

    You can then use this pattern with error handling:

     try
     {
         //cause an error
     }
     catch(Exception ex)
     {
         MyExceptionHandlerMethod(new MyExceptionWrapper("I caused an error", ex));
         //OR - to throw up the stack
         throw new MyExceptionWrapper("I caused an error", ex);
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hii I have method in C#, I have to return multiple values from that
hiii all , I am getting soap fault exception type of 'Microsoft.SharePoint.SoapServer.SoapServerException my code
hiii...i am able to show image from images urls, actually images urls was stored
Hiii how can we track the status of email sent from drupal. I want
Is there a built-in method in Python to get an array of all a
I tried to call simple Web Method from JSON but I am getting errors.
hii I want attractive buttons for my website how can i do that
hiii frends, actually i am working on an application which requires images such as
hiii db_query gives empty result for some keywords .Here is my query. $query =
Hii I was coding for an application that shows the list of running process

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.