mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing comments and removing cakeError(). Instead you should be throwing exceptions.
This commit is contained in:
parent
af87e5d5bc
commit
fa7549dc4c
2 changed files with 3 additions and 31 deletions
|
@ -24,8 +24,8 @@
|
|||
* Error Handler.
|
||||
*
|
||||
* Captures and handles all unhandled exceptions. Displays helpful framework errors when debug > 1.
|
||||
* When debug < 1 cakeError() will render 404 or 500 errors. If an uncaught exception is thrown
|
||||
* and it is a type that ErrorHandler does not know about it will be treated as a 500 error.
|
||||
* When debug < 1 a CakeException will render 404 or 500 errors. If an uncaught exception is thrown
|
||||
* and it is a type that ErrorHandler does not know about it will be treated as a 500 error.
|
||||
*
|
||||
* ### Implementing application specific exception handling
|
||||
*
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Object class, allowing __construct and __destruct in PHP4.
|
||||
* Object class provides a few generic methods used in several subclasses.
|
||||
*
|
||||
* Also includes methods for logging and the special method RequestAction,
|
||||
* to call other Controllers' Actions from anywhere.
|
||||
|
@ -155,34 +155,6 @@ class Object {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to report user friendly errors.
|
||||
* If there is a file app/error.php or app/app_error.php this file will be loaded
|
||||
* error.php is the AppError class it should extend ErrorHandler class.
|
||||
*
|
||||
* @param string $method Method to be called in the error class (AppError or ErrorHandler classes)
|
||||
* @param array $messages Message that is to be displayed by the error class
|
||||
* @return error message
|
||||
*/
|
||||
public function cakeError($method, $messages = array()) {
|
||||
if (!class_exists('ErrorHandler')) {
|
||||
App::import('Core', 'Error');
|
||||
|
||||
if (file_exists(APP . 'error.php')) {
|
||||
include_once (APP . 'error.php');
|
||||
} elseif (file_exists(APP . 'app_error.php')) {
|
||||
include_once (APP . 'app_error.php');
|
||||
}
|
||||
}
|
||||
|
||||
if (class_exists('AppError')) {
|
||||
$error = new AppError($method, $messages);
|
||||
} else {
|
||||
$error = new ErrorHandler($method, $messages);
|
||||
}
|
||||
return $error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks for a persistent class file, if found file is opened and true returned
|
||||
* If file is not found a file is created and false returned
|
||||
|
|
Loading…
Reference in a new issue