Error handling methods for commonobject (#37201)

This commit is contained in:
hansemschnokeloch
2026-02-12 16:42:55 +01:00
committed by Laurent Destailleur
parent caa5d7b347
commit c820404856

View File

@@ -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);
}
}