user2061383
user2061383

Reputation: 1

is try/catch in php always working fine?

i try to handle exception and write code as follows but i also get exception when document save sucessfully in my databse.

$table = "MyRequestTable";
$smsID = new MongoId();
$data = array("_id" => $smsID,
            "requestUserid" => 2500,
            "requestDate" => new MongoDate(strtotime(date('Y-m-d H:i:s'))),
            "requestNosSms" => 1
        );
try
{
     $result = $table->insert($data, array("safe" => TRUE)); 
     echo $smsID ;
}
catch (Exception $e) 
{
    echo $e->getMessage();
}

i got following exception "Invalid modifier specified: $push"

Upvotes: 0

Views: 1246

Answers (1)

Dmytro Zarezenko
Dmytro Zarezenko

Reputation: 10686

Even if INSERT command executed correct may be situation when some other instruction throws exception. Are you sure that other parts of code are correct?

Upvotes: 2

Related Questions