-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: Usability
-
None
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.