diff --git a/src/web/implement/ArkRouteErrorHandlerAsCallback.php b/src/web/implement/ArkRouteErrorHandlerAsCallback.php new file mode 100644 index 0000000..6484930 --- /dev/null +++ b/src/web/implement/ArkRouteErrorHandlerAsCallback.php @@ -0,0 +1,22 @@ +requestErrorCallback($errorData, $http_code); + } +} \ No newline at end of file diff --git a/src/web/implement/ArkRouteErrorHandlerAsPage.php b/src/web/implement/ArkRouteErrorHandlerAsPage.php new file mode 100644 index 0000000..0f57042 --- /dev/null +++ b/src/web/implement/ArkRouteErrorHandlerAsPage.php @@ -0,0 +1,40 @@ +templateFile = $this->getTemplateFile(); + } + + /** + * @return string + */ + abstract public function getTemplateFile(); + + public function execute($errorData = [], $http_code = 404) + { + try { + if (!is_string($this->templateFile) || !file_exists($this->templateFile)) { + throw new Exception("ArkRouteErrorHandler::Template file is not available."); + } + Ark()->webOutput() + ->sendHTTPCode($http_code) + ->displayPage($this->templateFile, $errorData); + } catch (Exception $exception) { + echo $exception->getMessage() . PHP_EOL . $exception->getTraceAsString(); + } + } +} \ No newline at end of file