Error handling methods for commonobject (#37201)
This commit is contained in:
parent
caa5d7b347
commit
c820404856
1 changed files with 25 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue