Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-133

Feature request: Improved error messaging

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor - P4 Minor - P4
    • None
    • None
    • Usability
    • None

    Description

      Instead of:

      Array
      (
      [err] => E11000 duplicate key errorindex: example.books.$id dup key: { : 3 }
      [n] => 0
      [ok] => 1
      )

      Something like:

      Array
      (
      [err] => Array
      (
      [num] => 11000
      [msg] => duplicate key
      [index] => example.books.$_id
      [key] => 3
      )
      [n] => 0
      [ok] => 1
      )

      This will make it much easier to handle errors in the user's code. Now, the same error can generate different messages (because the messages includes the key on which the method failed), which makes it really hard to distinguish if I'm dealing with a duplicate key error, or another error.

      This goes for all errors of course. Each error message should include a 'num' field, and all errors (with their corresponding numbers) should be listed somewhere on your site.

      Attachments

        Activity

          People

            eliot Eliot Horowitz (Inactive)
            wouter Wouter
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: