From ec46cdf0a91a054924989177848dd51fde9c2dc2 Mon Sep 17 00:00:00 2001 From: Marc Egger <marc.egger@uzh.ch> Date: Thu, 1 Oct 2020 17:36:58 +0200 Subject: [PATCH] Revert "remove new error catch syntax with '|' since gitlab runner PHP does not support" This reverts commit b6ffdc84. We should increase the PHP version instead. --- extension/Classes/Core/Exception/AbstractException.php | 4 +--- extension/Classes/Core/Report/ColumnScript.php | 10 ++-------- extension/NoT3Page/index.php | 4 +--- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/extension/Classes/Core/Exception/AbstractException.php b/extension/Classes/Core/Exception/AbstractException.php index 1b8827a1a..f43e0edfe 100644 --- a/extension/Classes/Core/Exception/AbstractException.php +++ b/extension/Classes/Core/Exception/AbstractException.php @@ -175,9 +175,7 @@ class AbstractException extends \Exception { $arrMerged[ERROR_MESSAGE_TO_DEVELOPER] = QuickFormQuery::buildInlineReport(\UserReportException::$report_uid, \UserReportException::$report_pathFileName, \UserReportException::$report_bodytext, \UserReportException::$report_header) . $arrMerged[ERROR_MESSAGE_TO_DEVELOPER]; - } catch (\Error $e) { - $arrMerged[ERROR_MESSAGE_TO_DEVELOPER] .= "<br>(inline report editor not available)"; - } catch (\Exception $e) { + } catch (\Error | \Exception $e) { $arrMerged[ERROR_MESSAGE_TO_DEVELOPER] .= "<br>(inline report editor not available)"; } diff --git a/extension/Classes/Core/Report/ColumnScript.php b/extension/Classes/Core/Report/ColumnScript.php index 85b1deaaf..9305f9c1f 100644 --- a/extension/Classes/Core/Report/ColumnScript.php +++ b/extension/Classes/Core/Report/ColumnScript.php @@ -64,9 +64,7 @@ class ColumnScript { // this will be caught bellow throw new \Exception('Include failed.'); } - } catch (\Exception $e) { - Thrower::userReportException('Error during reading script file.', "Error message:\n" . $e->getMessage()); - } catch (\Error $e) { + } catch (\Exception | \Error $e) { Thrower::userReportException('Error during reading script file.', "Error message:\n" . $e->getMessage()); } @@ -78,11 +76,7 @@ class ColumnScript { try { $return = call_user_func_array($param[TOKEN_FUNCTION_CALL], [$param, new ScriptFunctions()]); $output = ob_get_clean(); - } catch (\Exception $e) { - ob_end_clean(); - Thrower::userReportException('Function execution failed.', - "Error message:\n" . $e->getMessage() . "\n\nFunction: " . $param[TOKEN_FUNCTION_CALL] . "\n\nParameters:\n" . print_r($param,true)); - } catch (\Error $e) { + } catch (\Exception | \Error $e) { ob_end_clean(); Thrower::userReportException('Function execution failed.', "Error message:\n" . $e->getMessage() . "\n\nFunction: " . $param[TOKEN_FUNCTION_CALL] . "\n\nParameters:\n" . print_r($param,true)); diff --git a/extension/NoT3Page/index.php b/extension/NoT3Page/index.php index 7eb473fde..7e6f2e105 100644 --- a/extension/NoT3Page/index.php +++ b/extension/NoT3Page/index.php @@ -414,9 +414,7 @@ try { } catch (\DownloadException $e) { $html = $e->formatMessage(); -} catch (\Error $e) { - $html = "Generic Exception: " . $e->getMessage() . (IS_DEBUG ? ("<br>" . nl2br($e->getTraceAsString())) : ''); -} catch (\Exception $e) { +} catch (\Error | \Exception $e) { $html = "Generic Exception: " . $e->getMessage() . (IS_DEBUG ? ("<br>" . nl2br($e->getTraceAsString())) : ''); } -- GitLab