From d06cac435541022230e4bda9ad28cd75b41907a4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Thu, 16 Dec 2021 15:31:24 +0100 Subject: [PATCH] Continued: - some exception messages changed (more generalized) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../main/classes/criteria/search/class_SearchCriteria.php | 4 ++-- .../classes/database/result/class_CachedDatabaseResult.php | 2 +- .../file_directories/text/input/csv/class_CsvInputFile.php | 2 +- framework/main/classes/handler/tasks/class_TaskHandler.php | 6 ++---- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/framework/main/classes/criteria/search/class_SearchCriteria.php b/framework/main/classes/criteria/search/class_SearchCriteria.php index fd1e8044..43492dc3 100644 --- a/framework/main/classes/criteria/search/class_SearchCriteria.php +++ b/framework/main/classes/criteria/search/class_SearchCriteria.php @@ -140,13 +140,13 @@ class SearchCriteria extends BaseCriteria implements LocalSearchCriteria { //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('SEARCH-CRITERIA: key=%s,value[]=%s,separator=%s - CALLED!', $key, gettype($value), $separator)); if (empty($key)) { // Throw IAE - throw new InvalidArgumentException('Parameter "key" cannot be empty'); + throw new InvalidArgumentException('Parameter "key" is empty'); } elseif (is_array($value) || is_bool($value) || is_bool($value) || is_object($value) || is_resource($value)) { // Throw it again throw new InvalidArgumentException(sprintf('value[]=%s is not supported/valid', gettype($value))); } elseif (empty($separator)) { // Throw IAE - throw new InvalidArgumentException('Parameter "separator" cannot be empty'); + throw new InvalidArgumentException('Parameter "separator" is empty'); } // "Explode" value diff --git a/framework/main/classes/database/result/class_CachedDatabaseResult.php b/framework/main/classes/database/result/class_CachedDatabaseResult.php index 58ca052e..25ff9644 100644 --- a/framework/main/classes/database/result/class_CachedDatabaseResult.php +++ b/framework/main/classes/database/result/class_CachedDatabaseResult.php @@ -95,7 +95,7 @@ class CachedDatabaseResult extends BaseDatabaseResult implements SearchableResul // Misses an element? if (count($resultArray) == 0) { // Cannot be empty - throw new InvalidArgumentException('Array "resultArray" cannot be empty.'); + throw new InvalidArgumentException('Array "resultArray" is empty'); } elseif (!array_key_exists(BaseDatabaseResult::RESULT_NAME_ROWS, $resultArray)) { // Yes, then abort here throw new InvalidArgumentException(sprintf('resultArray(%d)=%s has no element "%s".', count($resultArray), print_r($resultArray, TRUE), BaseDatabaseResult::RESULT_NAME_ROWS)); diff --git a/framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php b/framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php index 81079f2e..cba62715 100644 --- a/framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php +++ b/framework/main/classes/file_directories/text/input/csv/class_CsvInputFile.php @@ -77,7 +77,7 @@ class CsvInputFile extends BaseInputTextFile implements CsvInputStreamer { /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d:] columnSeparator=%s,expectedMatches=%d - CALLED!', __METHOD__, __LINE__, $columnSeparator, $expectedMatches)); if (strlen($columnSeparator) === 0) { // No empty column separator - throw new InvalidArgumentException('columnSeparator cannot be empty.'); + throw new InvalidArgumentException('Parameter "columnSeparator" is empty'); } elseif ($expectedMatches < 0) { // Below zero is not valid throw new InvalidArgumentException(sprintf('expectedMatches=%d is below zero', $expectedMatches)); diff --git a/framework/main/classes/handler/tasks/class_TaskHandler.php b/framework/main/classes/handler/tasks/class_TaskHandler.php index 818ed694..a2aa58d0 100644 --- a/framework/main/classes/handler/tasks/class_TaskHandler.php +++ b/framework/main/classes/handler/tasks/class_TaskHandler.php @@ -137,10 +137,8 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { // Get time difference from interval delay $diff = ($this->getMilliTime() - $currentTask['task_last_activity']) * 1000; - // Debug message - //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK-HANDLER: Task ' . $currentTask['id'] . ' diff=' . $diff . ',task_interval_delay=' . $currentTask['task_interval_delay'] . ',task_max_runs=' . $currentTask['task_max_runs'] . ',task_total_runs=' . $currentTask['task_total_runs']); - // Is the interval delay reached? + //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('TASK-HANDLER: Task ' . $currentTask['id'] . ' diff=' . $diff . ',task_interval_delay=' . $currentTask['task_interval_delay'] . ',task_max_runs=' . $currentTask['task_max_runs'] . ',task_total_runs=' . $currentTask['task_total_runs']); if ((($diff < $currentTask['task_interval_delay']) && ($currentTask['task_max_runs'] == 0)) || (($currentTask['task_max_runs'] > 0) && ($currentTask['task_total_runs'] == $currentTask['task_max_runs']))) { // Should we update the task from startup? if ($updateTask === true) { @@ -242,7 +240,7 @@ class TaskHandler extends BaseHandler implements Registerable, HandleableTask { // Is the parameter valid if (empty($taskName)) { // Task name cannot be empty - throw new InvalidArgumentException('Parameter "taskName" cannot be empty.'); + throw new InvalidArgumentException('Parameter "taskName" is empty'); } // Get interval delay, startup delay and max runs -- 2.39.5