как заставить Yii передавать управление в блок catch при исключении, а не своему внутреннему обработчику?
Пример:
Код: Выделить всё
try {
$handle = fopen("/wrongPath", "w");
} catch (Exception $exc) {
echo 'Im newer be seen';
}
Код: Выделить всё
try {
$handle = fopen("/wrongPath", "w");
} catch (Exception $exc) {
echo 'Im newer be seen';
}
Код: Выделить всё
function myErrorHandler($errno, $errstr, $errfile, $errline) {
echo $errstr . ' >>' . $errfile;
}
set_error_handler('myErrorHandler');
Код: Выделить всё
set_error_handler(array('MyErrorHandler', 'errorToException'));
try {
$handle = fopen("/wrongPath", "w");
} catch (Exception $exc) {
echo 'Im newer be seen';
}
restore_error_handler();
Код: Выделить всё
class MyErrorHandler {
public static function errorToException($code, $message, $file, $line) {
throw new Exception($message, $code);
}
}