try { // some code that may cause an error } catch (Exception $e) { $appError = new \AppError\ErrorHandler; $appError->displayError($e->getMessage()); }
try { // some code that may cause an error } catch (Exception $e) { $appError = new \AppError\ErrorHandler; $appError->setTemplate('custom_error_page.php'); $appError->setVariables(array( 'error_message' => $e->getMessage() )); $appError->displayError(); }In this example, we use the `setTemplate()` method to set a custom error page template, and `setVariables()` method to pass variables to the template. PHP App Error is part of the Composer package library.