mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-02-13 19:25:22 +01:00
Error handling methods for commonobject (#37201)
This commit is contained in:
committed by
Laurent Destailleur
parent
caa5d7b347
commit
c820404856
@@ -11705,4 +11705,29 @@ abstract class CommonObject
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the error message for the object without logging it.
|
||||
*
|
||||
* @param string $message the error message
|
||||
* @return void
|
||||
*/
|
||||
public function setErrorWithoutLog($message)
|
||||
{
|
||||
$this->error = $message;
|
||||
$this->errors[] = $message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the error message for the object and log it.
|
||||
*
|
||||
* @param string $message the error message
|
||||
* @param int<0,7> $loglevel the log level
|
||||
* @return void
|
||||
*/
|
||||
public function setErrorWithLog($message, $loglevel = LOG_ERR)
|
||||
{
|
||||
$this->setErrorWithoutLog($message);
|
||||
dol_syslog($message, $loglevel);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user