1
ouioui
How Use ErrorHandler in a ajax architecture
  • 2006/3/29 14:01

  • ouioui

  • Just popping in

  • Posts: 32

  • Since: 2003/7/11


Hi,

I try to do an ajax module but when i have php i can catch the error.
I see a XoopsErrorHandler and a ErrorHandler class.
How can i use it ? If there is documentation ?

2
ouioui
response
  • 2006/3/30 8:43

  • ouioui

  • Just popping in

  • Posts: 32

  • Since: 2003/7/11


For people who are reading this thread :
There is no documentation about errorhandler except the code.

You must see
..\class\errorhandler.php
function XoopsErrorHandler()
{
  
set_error_handler('XoopsErrorHandler_HandleError');
  
register_shutdown_function('XoopsErrorHandler_Shutdown'); 
}


and to know are are doing the XoopsErrorHandler, you must see the PHP doc...
- set_error_handler
- register_shutdown_function

3
ouioui
Re: response
  • 2006/3/30 10:42

  • ouioui

  • Just popping in

  • Posts: 32

  • Since: 2003/7/11


I have log the errors because the XoopsErrorHandler_Shutdown do an "echo" witch can be intercept by the browser in case of ajax architecture.

Dowload the pear log package :
http://pear.php.net/package/Log/

And code in ..\class\errorhandler.php file the folowing code

function XoopsErrorHandler_Shutdown() {
 
$error_handler =& XoopsErrorHandler::getInstance();
 require 
XOOPS_ROOT_PATH.'/class/Log.php'// the pear log
 
$conf = array('mode' => 0600'timeFormat' => '%X %x');
 
$log_error = &Log::singleton('file''error.log''ident'$conf);
 
$log_error->log($error_handler->renderErrors());
//    echo $error_handler->renderErrors();
}


instead of
function XoopsErrorHandler_Shutdown()
{
 
$error_handler =& XoopsErrorHandler::getInstance();
 echo 
$error_handler->renderErrors();
}


Hope that helps,

Login

Who's Online

167 user(s) are online (98 user(s) are browsing Support Forums)


Members: 0


Guests: 167


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits