Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2116

Add MongoDB Error Codes as Constants

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      MongoDB has a list of error codes here: https://github.com/mongodb/mongo/blob/master/src/mongo/base/error_codes.yml#L36. I think it would be helpful to have these error codes exposed as constants so that when handling `ServerErrors` when using the Go Driver, those constants can be used to handle specific errors. Otherwise, code that uses the go driver needs to copy + paste the error codes manually which can be error prone or might become out of sync. In addition, non-MongoDB employees might not easily know where to find these error codes.

      This came up during some work on index migration as part of Realm Sync but I think this would be beneficial to users of the Go Driver in general.

            Assignee:
            matt.dale@mongodb.com Matt Dale
            Reporter:
            rushil.kumar@mongodb.com Rushil Kumar
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: