232 |
*/ |
*/ |
233 |
protected function checkDBError($result, $msg = '') { |
protected function checkDBError($result, $msg = '') { |
234 |
if (database::isError($result, true)) { |
if (database::isError($result, true)) { |
235 |
$this->setMessage($msg.$this->formatDBerror($result->getDebugInfo(), |
$this->addToLog("Error: $msg ". |
236 |
$result->getMessage())); |
$this->formatDBerror($result->getDebugInfo(), |
237 |
|
$result->getMessage())); |
238 |
|
$this->setMessage('ERREUR DE LA BD : '. $msg); |
239 |
return true; |
return true; |
240 |
} |
} |
241 |
return false; |
return false; |
242 |
} |
} |
243 |
|
|
244 |
|
|
245 |
|
/* |
246 |
|
* Adds errors to log |
247 |
|
* @param string $message The message to add to log |
248 |
|
* @param string $type The logging mode |
249 |
|
* @todo what do we do with DB error messages if a REST call is made |
250 |
|
*/ |
251 |
|
function addToLog($message, $type = DEBUG_MODE) { |
252 |
|
// |
253 |
|
if (!defined('REST_REQUEST')) { |
254 |
|
logger::instance()->log("class ".get_class($this)." - ".$message, $type); |
255 |
|
} |
256 |
|
} |
257 |
|
|
258 |
}// fin classe |
}// fin classe |
259 |
?> |
?> |