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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.