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

MongoQueryException should provide response document that caused it

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 1.2
    • 1.2
    • None
    • Fully Compatible

    Description

      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 }

      "))

      { ... }

      }

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: