本文整理汇总了C++中WriteErrorDetail::setErrMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ WriteErrorDetail::setErrMessage方法的具体用法?C++ WriteErrorDetail::setErrMessage怎么用?C++ WriteErrorDetail::setErrMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WriteErrorDetail
的用法示例。
在下文中一共展示了WriteErrorDetail::setErrMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toWriteError
static WriteErrorDetail* toWriteError( const Status& status ) {
WriteErrorDetail* error = new WriteErrorDetail;
// TODO: Complex transform here?
error->setErrCode( status.code() );
error->setErrMessage( status.reason() );
return error;
}
示例2: checkIsMasterForCollection
static bool checkIsMasterForCollection(const std::string& ns, WriteOpResult* result) {
if (!isMasterNs(ns.c_str())) {
WriteErrorDetail* errorDetail = new WriteErrorDetail;
result->setError(errorDetail);
errorDetail->setErrCode(ErrorCodes::NotMaster);
errorDetail->setErrMessage("Not primary while writing to " + ns);
return false;
}
return true;
}
示例3: checkIsMasterForCollection
static bool checkIsMasterForCollection(const NamespaceString& ns, WriteErrorDetail** error) {
if (!isMasterNs(ns.ns().c_str())) {
WriteErrorDetail* errorDetail = *error = new WriteErrorDetail;
errorDetail->setErrCode(ErrorCodes::NotMaster);
errorDetail->setErrMessage(std::string(mongoutils::str::stream() <<
"Not primary while writing to " << ns.ns()));
return false;
}
return true;
}
示例4: checkIsMasterForDatabase
static bool checkIsMasterForDatabase(const std::string& ns, WriteOpResult* result) {
if (!repl::getGlobalReplicationCoordinator()->canAcceptWritesForDatabase(
NamespaceString(ns).db())) {
WriteErrorDetail* errorDetail = new WriteErrorDetail;
result->setError(errorDetail);
errorDetail->setErrCode(ErrorCodes::NotMaster);
errorDetail->setErrMessage("Not primary while writing to " + ns);
return false;
}
return true;
}
示例5: lastErrorToBatchError
WriteErrorDetail* BatchSafeWriter::lastErrorToBatchError( const LastError& lastError ) {
bool isFailedOp = lastError.msg != "";
bool isStaleOp = lastError.writebackId.isSet();
dassert( !( isFailedOp && isStaleOp ) );
if ( isFailedOp ) {
WriteErrorDetail* batchError = new WriteErrorDetail;
if ( lastError.code != 0 ) batchError->setErrCode( lastError.code );
else batchError->setErrCode( ErrorCodes::UnknownError );
batchError->setErrMessage( lastError.msg );
return batchError;
}
else if ( isStaleOp ) {
WriteErrorDetail* batchError = new WriteErrorDetail;
batchError->setErrCode( ErrorCodes::StaleShardVersion );
batchError->setErrInfo( BSON( "downconvert" << true ) ); // For debugging
batchError->setErrMessage( "shard version was stale" );
return batchError;
}
return NULL;
}