Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-2509

Expose server error code name in OperationFailure exception message

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 2.15.0.alpha
    • None
    • None
    • Minor Change

    Description

      Currently the driver exposes the code name in an attribute of Mongo::Error::OperationFailure, but not in the exception message itself. It would be helpful for diagnostics if the code name was included in the exception message.

      Since the message is being changed, I also suggest making it more clear that the error code (in parentheses) comes from the server. Especially for low numbered error codes (1-2 digits), to me, it is frequently not clear that the error code is server-generated.

      Looking at the relevant code it seems there is quite a bit of logic to extract error messages from what I assume are ancient server responses of server versions that the driver no longer supports (pre-2.6). The parsing that predates 2.6, if identified, can be removed.

      The following errors contain messages that are affected:

      OperationFailure (add code name, change formatting)
      BulkWriteError (code name not provided by server, change formatting to match OperationFailure)
      Auth errors (code name already exposed, change formatting to match OperationFailure)

      Attachments

        Issue Links

          Activity

            People

              oleg.pudeyev@mongodb.com Oleg Pudeyev
              oleg.pudeyev@mongodb.com Oleg Pudeyev
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: