コード例 #1
0
 private function _exception_management(\MongoException $e)
 {
     switch ($e->getCode()) {
         case '1':
             $type = 'wrong_key';
             $message = 'You are trying to save a document with empty key';
             break;
         case '2':
             $type = 'wrong_key';
             $message = 'You are trying to save a document with not allowed format key : ' . $e->getMessage();
             break;
         case '3':
             $type = 'invalid_parameters';
             $message = 'Insert or update parameters weight is too big : ' . $e->getMessage();
             break;
         case '4':
             $type = 'invalid_parameters';
             $message = 'You are trying to save an empty document : ' . $e->getMessage();
             break;
         case '5':
             $type = 'wrong_key';
             $message = 'You are trying to save a document with non string keys : ' . $e->getMessage();
             break;
         default:
             $type = 'data_storage_exception';
             $message = $e->getMessage();
     }
     throw $this->except($message, $type);
 }
コード例 #2
0
ファイル: MongoDB.php プロジェクト: ravikathaitarm01/fluenz1
 /**
  * Returns the last error message
  *
  * @return string
  */
 public function last_error_message()
 {
     return is_object($this->_last_error) ? $this->_last_error->getMessage() : '';
 }