@@ -201,7 +201,7 @@ function bulkWrite(array $bulk, array $options = array()) { /* {{{ */
201201 foreach ($ bulk as $ n => $ op ) {
202202 foreach ($ op as $ opname => $ args ) {
203203 if (!isset ($ args [0 ])) {
204- throw \RuntimeException (sprintf ("Missing argument#1 for '%s' (operation#%d) " , $ opname , $ n ));
204+ throw new \ InvalidArgumentException (sprintf ("Missing argument#1 for '%s' (operation#%d) " , $ opname , $ n ));
205205 }
206206
207207 switch ($ opname ) {
@@ -211,7 +211,7 @@ function bulkWrite(array $bulk, array $options = array()) { /* {{{ */
211211
212212 case "updateMany " :
213213 if (!isset ($ args [1 ])) {
214- throw \RuntimeException (sprintf ("Missing argument#2 for '%s' (operation#%d) " , $ opname , $ n ));
214+ throw new \ InvalidArgumentException (sprintf ("Missing argument#2 for '%s' (operation#%d) " , $ opname , $ n ));
215215 }
216216 $ options = array_merge ($ this ->getWriteOptions (), isset ($ args [2 ]) ? $ args [2 ] : array (), array ("limit " => 0 ));
217217
@@ -220,23 +220,23 @@ function bulkWrite(array $bulk, array $options = array()) { /* {{{ */
220220
221221 case "updateOne " :
222222 if (!isset ($ args [1 ])) {
223- throw \RuntimeException (sprintf ("Missing argument#2 for '%s' (operation#%d) " , $ opname , $ n ));
223+ throw new \ InvalidArgumentException (sprintf ("Missing argument#2 for '%s' (operation#%d) " , $ opname , $ n ));
224224 }
225225 $ options = array_merge ($ this ->getWriteOptions (), isset ($ args [2 ]) ? $ args [2 ] : array (), array ("limit " => 1 ));
226226 if (key ($ args [1 ])[0 ] != '$ ' ) {
227- throw new \RuntimeException ("First key in \$update must be a \$operator " );
227+ throw new \InvalidArgumentException ("First key in \$update must be a \$operator " );
228228 }
229229
230230 $ batch ->update ($ args [0 ], $ args [1 ], $ options );
231231 break ;
232232
233233 case "replaceOne " :
234234 if (!isset ($ args [1 ])) {
235- throw \RuntimeException (sprintf ("Missing argument#2 for '%s' (operation#%d) " , $ opname , $ n ));
235+ throw new \ InvalidArgumentException (sprintf ("Missing argument#2 for '%s' (operation#%d) " , $ opname , $ n ));
236236 }
237237 $ options = array_merge ($ this ->getWriteOptions (), isset ($ args [2 ]) ? $ args [2 ] : array (), array ("limit " => 1 ));
238238 if (key ($ args [1 ])[0 ] == '$ ' ) {
239- throw new \RuntimeException ("First key in \$update must NOT be a \$operator " );
239+ throw new \InvalidArgumentException ("First key in \$update must NOT be a \$operator " );
240240 }
241241
242242 $ batch ->update ($ args [0 ], $ args [1 ], $ options );
@@ -253,7 +253,7 @@ function bulkWrite(array $bulk, array $options = array()) { /* {{{ */
253253 break ;
254254
255255 default :
256- throw \RuntimeException (sprintf ("Unknown operation type called '%s' (operation#%d) " , $ opname , $ n ));
256+ throw new \ InvalidArgumentException (sprintf ("Unknown operation type called '%s' (operation#%d) " , $ opname , $ n ));
257257 }
258258 }
259259 }
@@ -297,15 +297,15 @@ protected function _update($filter, $update, $options) { /* {{{ */
297297 } /* }}} */
298298 function replaceOne (array $ filter , array $ update , array $ options = array ()) { /* {{{ */
299299 if (key ($ update )[0 ] == '$ ' ) {
300- throw new \RuntimeException ("First key in \$update must NOT be a \$operator " );
300+ throw new \InvalidArgumentException ("First key in \$update must NOT be a \$operator " );
301301 }
302302 $ wr = $ this ->_update ($ filter , $ update , $ options );
303303
304304 return new UpdateResult ($ wr );
305305 } /* }}} */
306306 function updateOne (array $ filter , array $ update , array $ options = array ()) { /* {{{ */
307307 if (key ($ update )[0 ] != '$ ' ) {
308- throw new \RuntimeException ("First key in \$update must be a \$operator " );
308+ throw new \InvalidArgumentException ("First key in \$update must be a \$operator " );
309309 }
310310 $ wr = $ this ->_update ($ filter , $ update , $ options );
311311
@@ -503,7 +503,7 @@ function getFindOneAndDeleteOptions() { /* {{{ */
503503
504504 function findOneAndReplace (array $ filter , array $ replacement , array $ options = array ()) { /* {{{ */
505505 if (key ($ replacement )[0 ] == '$ ' ) {
506- throw new \RuntimeException ("First key in \$replacement must NOT be a \$operator " );
506+ throw new \InvalidArgumentException ("First key in \$replacement must NOT be a \$operator " );
507507 }
508508
509509 $ options = array_merge ($ this ->getFindOneAndReplaceOptions (), $ options );
@@ -566,7 +566,7 @@ function getFindOneAndReplaceOptions() { /* {{{ */
566566
567567 function findOneAndUpdate (array $ filter , array $ update , array $ options = array ()) { /* {{{ */
568568 if (key ($ update )[0 ] != '$ ' ) {
569- throw new \RuntimeException ("First key in \$update must be a \$operator " );
569+ throw new \InvalidArgumentException ("First key in \$update must be a \$operator " );
570570 }
571571
572572 $ options = array_merge ($ this ->getFindOneAndUpdateOptions (), $ options );
0 commit comments