本文整理汇总了C++中Status::codeString方法的典型用法代码示例。如果您正苦于以下问题:C++ Status::codeString方法的具体用法?C++ Status::codeString怎么用?C++ Status::codeString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::codeString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: validateIndexKey
BSONObj validateIndexKey(const BSONObj& a, void* data) {
BSONObj key = a[0].Obj();
Status indexValid = validateKeyPattern(key);
if (!indexValid.isOK()) {
return BSON("" << BSON("ok" << false << "errmsg" << indexValid.codeString()));
}
return BSON("" << BSON("ok" << true));
}
示例2: _acquirePrivilegesForPrincipalFromDatabase
void AuthorizationManager::_acquirePrivilegesForPrincipalFromDatabase(
const std::string& dbname, const PrincipalName& principal) {
BSONObj privilegeDocument;
Status status = getPrivilegeDocument(dbname, principal, &privilegeDocument);
if (status.isOK()) {
status = acquirePrivilegesFromPrivilegeDocument(dbname, principal, privilegeDocument);
}
if (!status.isOK() && status != ErrorCodes::UserNotFound) {
log() << "Privilege acquisition failed for " << principal << " in database " <<
dbname << ": " << status.reason() << " (" << status.codeString() << ")" << endl;
}
}
示例3: _acquirePrivilegesForPrincipalFromDatabase
void AuthorizationSession::_acquirePrivilegesForPrincipalFromDatabase(
const std::string& dbname, const UserName& user) {
BSONObj privilegeDocument;
Status status = _externalState->getAuthorizationManager().getPrivilegeDocument(
dbname, user, &privilegeDocument);
if (status.isOK()) {
status = acquirePrivilegesFromPrivilegeDocument(dbname, user, privilegeDocument);
}
if (!status.isOK() && status != ErrorCodes::UserNotFound) {
log() << "Privilege acquisition failed for " << user << " in database " <<
dbname << ": " << status.reason() << " (" << status.codeString() << ")" << endl;
}
}
示例4: run
virtual bool run(const string &db, BSONObj &cmdObj, int options, string &errmsg, BSONObjBuilder &result, bool fromRepl) {
BSONElement e = cmdObj.firstElement();
long long bps;
if (e.type() == String) {
Status status = BytesQuantity<long long>::fromString(e.Stringdata(), bps);
if (!status.isOK()) {
stringstream ss;
ss << "error parsing number " << e.Stringdata() << ": " << status.codeString() << " " << status.reason();
errmsg = ss.str();
return false;
}
}
else {
if (!e.isNumber()) {
errmsg = "backupThrottle argument must be a number";
return false;
}
bps = e.safeNumberLong();
}
return Manager::throttle(bps, errmsg, result);
}
示例5: uasserted
void ObjectInfo::Functions::invalidForStorage::call(JSContext* cx, JS::CallArgs args) {
if (args.length() != 1)
uasserted(ErrorCodes::BadValue, "invalidForStorage needs 1 argument");
if (args.get(0).isNull()) {
args.rval().setNull();
return;
}
if (!args.get(0).isObject())
uasserted(ErrorCodes::BadValue, "argument to invalidForStorage has to be an object");
Status validForStorage = ValueWriter(cx, args.get(0)).toBSON().storageValid(true);
if (validForStorage.isOK()) {
args.rval().setNull();
return;
}
std::string errmsg = str::stream() << validForStorage.codeString() << ": "
<< validForStorage.reason();
ValueReader(cx, args.rval()).fromStringData(errmsg);
}