View Full Version : Custom Error Handling
01-13-2008, 09:39 PM
Hello, I am working on a website with a very graphical interface and when the die() function is called it will stop executing the script. The problem is, when it is called, the rest of the site doesn't load and it messes up the layout. I would like to make the error message print on a certain area of the page that can be globally used in all of my pages. Would I have to make a custom function and how would I go about in doing this?
Thanks in advanced!
01-13-2008, 09:43 PM
You could put the errors into a variable, then echo the variable out somewhere on the page!
01-13-2008, 11:40 PM
To stop executing the actual script and display the error and the rest of the page? How so?
Edit: Nevermind, I made a seperate function and called it instead of the regular die() function and it works fine, thanks anyways. :)
01-14-2008, 01:57 AM
Throw a new exception, this will die if you don't catch the exceptions.
Customize your trigger by setting the error handler (http://ca3.php.net/manual/en/function.set-error-handler.php)
Personally I'd go with the exception handling, but that is from working with other languages. Errors normally happen if something is unexpected or illegal, so I'd rely on exceptions instead.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.