filter notice and deprecated errors and write a proper error handler function

remotes/origin/stable45
Georg Ehrke 13 years ago
parent 7e53d82ff3
commit 926e777061
  1. 25
      lib/exception.php

@ -62,12 +62,31 @@ class OC_Exception extends Exception{
}
function oc_exceptionhandler($exception){
throw new OC_Exception($exception->getMessage(), $exception->getCode(), $exception->getFile(), $exception->getLine());
switch($exception->getCode()){
case E_NOTICE:
case E_DEPRECATED:
case E_USER_NOTICE:
case E_USER_DEPRECATED:
break;
default:
throw new OC_Exception($exception->getMessage(), $exception->getCode(), $exception->getFile(), $exception->getLine());
break;
}
return true;
}
function oc_errorhandler(){
function oc_errorhandler($errno , $errstr , $errfile , $errline){
switch($errno){
case E_NOTICE:
case E_DEPRECATED:
case E_USER_NOTICE:
case E_USER_DEPRECATED:
break;
default:
throw new OC_Exception($errstr, $errno, $errfile, $errline);
break;
}
return true;
}
set_exception_handler('oc_exceptionhandler');
set_error_handler('oc_errorhandler');

Loading…
Cancel
Save