summaryrefslogtreecommitdiff
path: root/src/mongo/shell
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@mongodb.com>2014-04-01 14:07:20 -0400
committerSpencer T Brody <spencer@mongodb.com>2014-04-03 12:54:51 -0400
commitabf252cfe8833ab15dc8d62e8e05a30108484508 (patch)
treeaf291cf527983ac6ef0929a8f7eeb92c331cdc3b /src/mongo/shell
parent93b962665da9d3163cacaf55817d8d60a957a32a (diff)
downloadmongo-abf252cfe8833ab15dc8d62e8e05a30108484508.tar.gz
SERVER-13441 getUser and getRole shell helpers shouldn't throw when user/role not found
Diffstat (limited to 'src/mongo/shell')
-rw-r--r--src/mongo/shell/db.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/shell/db.js b/src/mongo/shell/db.js
index d656a7703f8..e9572e7d8cb 100644
--- a/src/mongo/shell/db.js
+++ b/src/mongo/shell/db.js
@@ -1261,7 +1261,7 @@ DB.prototype.getUser = function(username, args) {
}
if (res.users.length == 0) {
- throw Error("User " + username + "@" + db.getName() + " not found");
+ return null;
}
return res.users[0];
}
@@ -1388,7 +1388,7 @@ DB.prototype.getRole = function(rolename, args) {
}
if (res.roles.length == 0) {
- throw Error("Role " + rolename + "@" + db.getName() + " not found");
+ return null;
}
return res.roles[0];
}