From: Roland Häder Date: Sat, 18 Feb 2023 00:44:39 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5c9360c9139b761d2b09351930c1e843d33af240;p=core.git Continued: - introduced new exception code EXCEPTION_LOGIC_EXCEPTION --- diff --git a/framework/main/classes/file_directories/class_BaseFileIo.php b/framework/main/classes/file_directories/class_BaseFileIo.php index 3dfab5b6..f167f94c 100644 --- a/framework/main/classes/file_directories/class_BaseFileIo.php +++ b/framework/main/classes/file_directories/class_BaseFileIo.php @@ -5,6 +5,7 @@ namespace Org\Mxchange\CoreFramework\Filesystem; // Import framework stuff use Org\Mxchange\CoreFramework\Filesystem\CloseableFile; use Org\Mxchange\CoreFramework\Filesystem\FilePointer; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; @@ -88,7 +89,7 @@ abstract class BaseFileIo extends BaseFrameworkSystem implements FilePointer, Cl throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); } elseif (!is_object($this->getFileObject())) { // Pointer is not a valid resource! - throw new LogicException(sprintf('this->fileObject[]=%s is no object', gettype($this->getFileObject()))); + throw new LogicException(sprintf('this->fileObject[]=%s is no object', gettype($this->getFileObject())), FrameworkInterface::EXCEPTION_LOGIC_EXCEPTION); } // Close the file pointer by NULL-ing it diff --git a/framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php b/framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php index d17a77c5..df6cc812 100644 --- a/framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php +++ b/framework/main/classes/file_directories/input/raw/class_FrameworkRawFileInputPointer.php @@ -9,6 +9,7 @@ use Org\Mxchange\CoreFramework\Filesystem\FileIoException; use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException; use Org\Mxchange\CoreFramework\Filesystem\FileReadProtectedException; use Org\Mxchange\CoreFramework\Filesystem\Pointer\InputPointer; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; @@ -113,7 +114,7 @@ class FrameworkRawFileInputPointer extends BaseFileIo implements InputPointer { throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); } elseif (!is_object($this->getFileObject())) { // Pointer is not a valid resource! - throw new LogicException(sprintf('this->fileObject[]=%s is no object', gettype($this->getFileObject()))); + throw new LogicException(sprintf('this->fileObject[]=%s is no object', gettype($this->getFileObject())), FrameworkInterface::EXCEPTION_LOGIC_EXCEPTION); } // Read data from the file pointer and return it diff --git a/framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php b/framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php index dee8f187..19985837 100644 --- a/framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php +++ b/framework/main/classes/file_directories/input/text/class_FrameworkTextFileInputPointer.php @@ -9,6 +9,7 @@ use Org\Mxchange\CoreFramework\Filesystem\FileIoException; use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException; use Org\Mxchange\CoreFramework\Filesystem\FileReadProtectedException; use Org\Mxchange\CoreFramework\Filesystem\Pointer\InputPointer; +use Org\Mxchange\CoreFramework\Generic\FrameworkInterface; use Org\Mxchange\CoreFramework\Generic\NullPointerException; use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException; use Org\Mxchange\CoreFramework\Object\BaseFrameworkSystem; @@ -133,7 +134,7 @@ class FrameworkTextFileInputPointer extends BaseFileIo implements InputPointer { throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); } elseif (!is_object($this->getFileObject())) { // Pointer is not a valid resource! - throw new LogicException(sprintf('this->fileObject[]=%s is no object', gettype($this->getFileObject()))); + throw new LogicException(sprintf('this->fileObject[]=%s is no object', gettype($this->getFileObject())), FrameworkInterface::EXCEPTION_LOGIC_EXCEPTION); } // Is $bytes set? diff --git a/framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php b/framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php index 9c242a11..638ab2d2 100644 --- a/framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php +++ b/framework/main/classes/file_directories/output/raw/class_FrameworkRawFileOutputPointer.php @@ -109,7 +109,7 @@ class FrameworkRawFileOutputPointer extends BaseFileIo implements OutputPointer throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); } elseif (!is_object($this->getFileObject())) { // Pointer is not a valid resource! - throw new LogicException(sprintf('this->fileObject[]=%s is no object', gettype($this->getFileObject()))); + throw new LogicException(sprintf('this->fileObject[]=%s is no object', gettype($this->getFileObject())), FrameworkInterface::EXCEPTION_LOGIC_EXCEPTION); } // Write data to the file pointer and return written bytes diff --git a/framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php b/framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php index 0df017c4..a70f7586 100644 --- a/framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php +++ b/framework/main/classes/file_directories/output/text/class_FrameworkTextFileOutputPointer.php @@ -106,7 +106,7 @@ class FrameworkTextFileOutputPointer extends BaseFileIo implements OutputPointer throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER); } elseif (!is_object($this->getFileObject())) { // Pointer is not a valid object! - throw new LogicException(sprintf('this->fileObject[]=%s is no object', gettype($this->getFileObject()))); + throw new LogicException(sprintf('this->fileObject[]=%s is no object', gettype($this->getFileObject())), FrameworkInterface::EXCEPTION_LOGIC_EXCEPTION); } // Write data to the file pointer and return written bytes diff --git a/framework/main/classes/iterator/registry/class_RegistryIterator.php b/framework/main/classes/iterator/registry/class_RegistryIterator.php index b90b6721..f8762d9a 100644 --- a/framework/main/classes/iterator/registry/class_RegistryIterator.php +++ b/framework/main/classes/iterator/registry/class_RegistryIterator.php @@ -171,7 +171,7 @@ class RegistryIterator extends BaseIterator implements IteratableRegistry { continue; } elseif (!($entry instanceof Registerable)) { // Not registerable?! - throw new LogicException(sprintf('entry[]=%s does not implement Registerable.', gettype($entry))); + throw new LogicException(sprintf('entry[]=%s does not implement Registerable.', gettype($entry)), FrameworkInterface::EXCEPTION_LOGIC_EXCEPTION); } // Is the current key set? diff --git a/framework/main/classes/utils/crypto/class_CryptoUtils.php b/framework/main/classes/utils/crypto/class_CryptoUtils.php index 5aa55105..6d8ac999 100644 --- a/framework/main/classes/utils/crypto/class_CryptoUtils.php +++ b/framework/main/classes/utils/crypto/class_CryptoUtils.php @@ -86,7 +86,7 @@ final class CryptoUtils extends BaseFrameworkSystem { throw new InvalidArgumentException('Parameter "str" is empty', FrameworkInterface::EXCEPTION_INVALID_ARGUMENT); } elseif (!extension_loaded('hash')) { // Should be there - throw new LogicException('Extension ext-hash not loaded'); + throw new LogicException('Extension ext-hash not loaded', FrameworkInterface::EXCEPTION_LOGIC_EXCEPTION); } // Invoke static initializer diff --git a/framework/main/interfaces/class_FrameworkInterface.php b/framework/main/interfaces/class_FrameworkInterface.php index 70e15b0e..b0fb3d1c 100644 --- a/framework/main/interfaces/class_FrameworkInterface.php +++ b/framework/main/interfaces/class_FrameworkInterface.php @@ -29,6 +29,7 @@ namespace Org\Mxchange\CoreFramework\Generic; interface FrameworkInterface { // Exception constants const EXCEPTION_INVALID_ARGUMENT = 0x200; + const EXCEPTION_LOGIC_EXCEPTION = 0x201; /** * Getter for field name