/** * Basic exception handling for the most common error cases, where * we simply want to return the right kind of HTTP error with the * appropriate information. * * @param dbException $e */ public function handleDBexception(dbException $e) { if ($e instanceof dbConnectionException) { $this->dbConnectionError($e->getMessage()); } elseif ($e instanceof dbQueryException) { $this->dbQueryError($e->getMessage() . "\n\nQuery: \n" . $e->sqlquery); } return $this; }
/** * Retorna a mensagem de erro * Não gerada por exceção * @return String * */ public function getError() { $error = new dbException($this->message, $this->code); return $error->getMessageError(); }
/** * PHP 5.3.0 introduces a 3rd argument for __construct. Change if nec. */ public function __construct($sqlcode, $sqlquery, $message = null, $code = 0) { $this->sqlcode = $sqlcode; $this->sqlquery = $sqlquery; parent::__construct($message, $code); }