diff options
author | Scott Hernandez <scotthernandez@gmail.com> | 2014-02-27 16:32:27 -0500 |
---|---|---|
committer | Scott Hernandez <scotthernandez@gmail.com> | 2014-02-27 16:39:48 -0500 |
commit | 04f7ab3acc4e10edac4e34a7a8a4bc47b1934132 (patch) | |
tree | 55a8f4dd9622d5bd879be5c8b294acb25c6e70c0 /src/mongo/db/ops/modifier_inc.cpp | |
parent | 552cce169154293d27c9b782cac8a5dec146ceae (diff) | |
download | mongo-04f7ab3acc4e10edac4e34a7a8a4bc47b1934132.tar.gz |
SERVER-12945: inc/mul error message more better
Diffstat (limited to 'src/mongo/db/ops/modifier_inc.cpp')
-rw-r--r-- | src/mongo/db/ops/modifier_inc.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mongo/db/ops/modifier_inc.cpp b/src/mongo/db/ops/modifier_inc.cpp index 17c681f06a7..ad5364317aa 100644 --- a/src/mongo/db/ops/modifier_inc.cpp +++ b/src/mongo/db/ops/modifier_inc.cpp @@ -113,8 +113,10 @@ namespace mongo { if (!modExpr.isNumber()) { // TODO: Context for mod error messages would be helpful // include mod code, etc. - return Status(ErrorCodes::BadValue, - str::stream() << "Cannot increment with non-numeric argument: {" + return Status(ErrorCodes::TypeMismatch, + str::stream() << "Cannot " + << (_mode == MODE_INC ? "increment" : "multiply") + << " with non-numeric argument: {" << modExpr << "}"); } @@ -191,7 +193,7 @@ namespace mongo { if (!_preparedState->elemFound.isNumeric()) { mb::Element idElem = mb::findFirstChildNamed(root, "_id"); return Status( - ErrorCodes::BadValue, + ErrorCodes::TypeMismatch, str::stream() << "Cannot apply " << (_mode == MODE_INC ? "$inc" : "$mul") << " to a value of non-numeric type. {" |