downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

MongoConnectionException> <MongoException
[edit] Last updated: Fri, 18 Sep 2009

view this page in

The MongoCursorException class

Увод

Thrown by accessing a cursor incorrectly.

Синтаксис за класове

MongoCursorException
extends MongoException {
}


add a note add a note User Contributed Notes MongoCursorException
Loc d&#39;Anterroches 18-Apr-2011 05:45
As all the exceptions are extending the base Exception class, you can get the code with the getCode() method:

<?php
try {
   
$collection->insert($duplicate_document, array('safe' => true));
} catch (
MongoCursorException $e) {
   
printf("Error code is %d.\n", $e->getCode();
    exit(
1);
}
Jay Paroline 20-Aug-2010 11:05
Not sure if it's intentional but all the properties on CursorException (including code) are protected or private, so you will have to handle all CursorExceptions the same.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites