Catzwolf Posted April 17, 2007 Share Posted April 17, 2007 Hi all, I am using a user defined function to handle php and system (userdefined errors) in a singleton class. Now I use this class to handle php errors and I aslo want it to handle user defined errors. Will this cause any problems than I am not aware of? example set_error_handler( 'MyErrorHandler_HandleError' ); function handleError( $errno, $errstr, $errfile, $errline ) { //do error stuff here } function MyErrorHandler_HandleError( $errNo, $errStr, $errFile, $errLine, $errContext = null ) { $_eh = &error_handler::instance(); $_eh ->handleError( $errNo, $errStr, $errFile, $errLine, $errContext ); } I use the above to trap php errors to output later. Now, I want to use this to handle user defined errors, like a database insert that failed or if a user entered a wrong password. Could I pass user defined error via this handler? Would this cause problems else where? MyErrorHandler_HandleError( '1002', 'Failed to to login, wrong username or password', __FILE__, __LINE__, null ); Sorry if this doesn't seem clear enough lol Thanks Catz Link to comment https://forums.phpfreaks.com/topic/47470-errror-handling-do-and-donts/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.