From b754374b79a419399dcce50a36d210d72c117347 Mon Sep 17 00:00:00 2001 From: Franzz Date: Mon, 2 Nov 2026 13:55:28 +0100 Subject: [PATCH] Add throw error function --- inc/PhpObject.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/inc/PhpObject.php b/inc/PhpObject.php index 36e6141..51a9627 100644 --- a/inc/PhpObject.php +++ b/inc/PhpObject.php @@ -96,6 +96,12 @@ class PhpObject $this->addMessage(self::ERROR_TAB, $sError); } + protected function throwError(string $sError): never + { + $this->addError($sError); + throw new \RuntimeException($sError); + } + private function addMessage($sType, $sMessage) { $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(); } -} \ No newline at end of file +}