Enhance Mongo::Error::Notable to handle strings and Error objects

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Works as Designed
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Dev Exp
    • None
    • Ruby Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Currently the Mongo::Error::Notable#add_note API is used to append a string to the @notes array.

      If a retryable error occurs, context about the error is appended as a note, but the error object itself is not retained, which can make it more challenging to inspect the original error without resorting to string introspection.

      Errno::EPIPE: Broken pipe (for /tmp/abc.sock) (on /tmp/abc.sock, connection 1:25, service id fake:3086912560, modern retry, attempt 1, later retry failed: Mongo::Error::OperationFailure: [11000]: E11000 duplicate key error collection: abc.xyz index: ip_address_1 dup key: { ip_address: "192.168.0.1" } (on /tmp/abc.sock, modern retry))
      

      For example, in the above scenario the error code from the operation failure could not be targeted directly, but would need to be extracted from the Mongo::Error#notes.to_s instead.

      The original error object should be made accessible in these scenarios.

            Assignee:
            Unassigned
            Reporter:
            Alex Bevilacqua
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: