Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-299

MongoQueryException should provide response document that caused it

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.2
    • Affects Version/s: 1.2
    • Component/s: None
    • Fully Compatible

      Currently, MongoQueryException only stores the message string. For our internal error handling mechanism it would be much better if it provided access to the response document.
      MongoCommandException, for example, has the ability to store CommandResult, and having something like QueryResult, containing the response document would be very good.
      I think this will be a good addition for everyone to use, at least to be able to do detailed logging.

      Currently, because there is no access to the response document we have to do error testing in the following way (yes, this code smells, but there's no choice right now) :
      catch (MongoQueryException exception)

      { if (exception.Message.Contains("\"code\" : 13435 }

      "))

      { ... }

      }

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            onyxmaster Aristarkh Zagorodnikov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: