Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-644

bson_error_t's "code" is often wrong

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.4.0
    • Affects Version/s: None
    • Component/s: errors
    • None
    • Major Change

      The mongoc_error_code_t enum does not agree with the server's error codes. For example, recent servers return error code 13 if a command is unauthorized, but 13 means MONGOC_ERROR_CLIENT_IN_EXHAUST in the enum. MONGOC_ERROR_CLIENT_AUTHENTICATE, on the other hand, is 11 in the enum. Nevertheless, when a command fails on the server the driver sets the bson_error_t's code to the server error code, as if the enum values and the server's values were related. Applications comparing a bson_error_t's "code" field to the enum values are often misinformed about the cause of the error.

      The enum and bson_error_t can't work as designed – the client and server can't share that list of codes, because they don't agree now and can't be made to agree in the future. I need to investigate if there is a simple upgrade path, or if I just need to document the problem now and wait for version 2.0 for a true fix.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: