php - Custom errorhandler with ajax call -


i have wrote own custom errorhandler in php @ works perfect if i've parse error in ajax file (e.g. 'fdskfgkhgkhdg' in file) errorhandler doesn't work... other errors no problem :)

can me?

 private function __construct(){     set_error_handler(array($this, 'errorhandler'));     set_exception_handler(array($this, 'exceptionhandler'));     register_shutdown_function(array($this, 'fatalhandler')); } public function errorhandler($errorno, $errormsg, $errorfile, $errorline){     $this->errorno = $errorno;     $this->errormsg = $errormsg;     $this->errorfile = $errorfile;     $this->errorline = $errorline;      switch ($errorno) {         case e_notice:         case e_user_notice:         case e_deprecated:         case e_user_deprecated:         case e_strict:         case e_warning:         case e_compile_warning:         case e_recoverable_error:         case e_user_warning:             $error = $this->generateerrormessage();             error_log('fehler #'.$this->errornumbers[$errorno]['errorcode'].': '.$error);             $this->senderrormail($error,$this->errornumbers[$errorno]['errorcode']);             break;          case e_error:         case e_user_error:         case e_parse:         case e_compile_error:             $error = $this->generateerrormessage();             error_log('fehler #' . $this->errornumbers[$errorno]['errorcode'] . ': ' . $error);             $this->senderrormail($error, $this->errornumbers[$errorno]['errorcode']);             if(!isajax()) {                 redirect('?show=error&errorcode=' . $this->errornumbers[$errorno]['errorcode']);             } else {                 ob_clean();                 echo buildfatalerrorresponse($this->errornumbers[$errorno]['errorcode']);                 die();             }             break;          default:             $error = $this->generateerrormessage();             error_log('fehler #'.$this->errornumbers[$errorno]['errorcode'].': '.$error);             $this->senderrormail($error,$this->errornumbers[$errorno]['errorcode']);             if(!isajax()) {                 redirect('?show=error&errorcode=' . $this->errornumbers[$errorno]['errorcode']);             } else {                 ob_clean();                 echo buildfatalerrorresponse($this->errornumbers[$errorno]['errorcode']);                 die();             }             break;     }     return true; }  public function fatalhandler(){     $error = error_get_last();     if($error) {         $this->errorhandler($error['type'],$error['message'],$error['file'],$error['line']);     } } 

and here ajax file:

bo_errorhandler::getinstance();

if(!isajax()){ redirect('/?show=notfound'); }

fghkjlkl


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -