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

Add MongoDB Error Codes as Constants

    XMLWordPrintable

Details

    • Improvement
    • Status: Waiting (Blocked)
    • Unknown
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              benji.rewis@mongodb.com Benji Rewis
              rushil.kumar@mongodb.com Rushil Kumar
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: