Skip to content

Commit be2bdcc

Browse files
committed
SERVER-12660: clean up error codes for parallelCollectionScan
1 parent 9041948 commit be2bdcc

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/mongo/db/commands/parallel_collection_scan.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,20 @@ namespace mongo {
189189
Database* db = cc().database();
190190
Collection* collection = db->getCollection( ns );
191191

192-
if ( !collection ) {
193-
errmsg = "ns does not exist";
194-
return false;
195-
}
196-
192+
if ( !collection )
193+
return appendCommandStatus( result,
194+
Status( ErrorCodes::NamespaceNotFound,
195+
str::stream() <<
196+
"ns does not exist: " << ns.ns() ) );
197197

198198
size_t numCursors = static_cast<size_t>( cmdObj["numCursors"].numberInt() );
199199

200-
if ( numCursors == 0 || numCursors > 10000 ) {
201-
errmsg = "numCursors has to be between 1 and 10000";
202-
return false;
203-
}
200+
if ( numCursors == 0 || numCursors > 10000 )
201+
return appendCommandStatus( result,
202+
Status( ErrorCodes::BadValue,
203+
str::stream() <<
204+
"numCursors has to be between 1 and 10000" <<
205+
" was: " << numCursors ) );
204206

205207
vector< vector<ExtentInfo> > buckets;
206208

0 commit comments

Comments
 (0)