Expose failure error in CommandFailedEvent.

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Duplicate
    • Priority: Trivial - P5
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Go 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

      Context

      Right now CommandFailedEvent only exposes the error’s stringification. It should at least expose the plain error instead.

      In REP-3858, mongosync is adding its new embedded verifier to existing end-to-end tests. That seems—unrelatedly?—to be causing a glut of StaleConfig errors and such, which mongosync doesn’t really care about and shouldn’t cause test failures.

      I’d like to filter those errors out, but right now that requires parsing a string. It’d be much cleaner if I had the actual mongo.ServerError so I could extract error codes and parse that way. Right now, though, that doesn’t exist in CommandFailedEvent, which is how we report raw errors from the driver.

      Definition of done

      Add a member to CommandFailedEvent that includes the raw error. Retain the existing Failure member to preserve compatibility.

      Pitfalls

      None?

      NB: If it’s not too late, I would think Go driver 2 would do well to use the raw error as Failure, and let applications call .Error() to get the string.

            Assignee:
            Felipe Gasper
            Reporter:
            Felipe Gasper
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: