Add throw error function

This commit is contained in:
franzz committed 2026-11-02 13:55:28 +01:00
1 parent d7922ef29e
commit b754374b79
1 file changed
+7 -1
+7 -1
View File
@@ -96,6 +96,12 @@ class PhpObject
$this->addMessage(self::ERROR_TAB, $sError); $this->addMessage(self::ERROR_TAB, $sError);
} }
protected function throwError(string $sError): never
{
$this->addError($sError);
throw new \RuntimeException($sError);
}
private function addMessage($sType, $sMessage) private function addMessage($sType, $sMessage)
{ {
$this->asMessageStack[$sType][] = array('msg'=>$sMessage, 'time'=>date('d.m.Y H:i:s'), 'type'=>$sType, 'location'=>$this->sChildClass); $this->asMessageStack[$sType][] = array('msg'=>$sMessage, 'time'=>date('d.m.Y H:i:s'), 'type'=>$sType, 'location'=>$this->sChildClass);
@@ -194,4 +200,4 @@ class PhpObject
{ {
$this->cleanMessageStack(); $this->cleanMessageStack();
} }
} }