[CSHARP-2593] Add numeric error code to default error message in NativeMethods.CreateException Created: 17/Apr/19  Updated: 31/Mar/22

Status: Backlog
Project: C# Driver
Component/s: Error Handling
Affects Version/s: 2.11.0
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Robert Stam Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

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}.";


Generated at Wed Feb 07 21:42:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.