Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-2593

Add numeric error code to default error message in NativeMethods.CreateException

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.11.0
    • Component/s: Error Handling
    • Labels:
      None

      The NativeMethods.CreateException method maps a known errorCode to a corresponding string, but if the errorCode is not one we know about we use the defaultMessage.

      When the defaultMessage is used this way some information is lost because we don't know what the errorCode was.

      We should append the error code to the default message, something like:

       message = defaultMessage + $" Error code {errorCode}.";
      

            Assignee:
            Unassigned Unassigned
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: