Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Jan 2006
    Posts
    73
    Thanks
    2
    Thanked 3 Times in 3 Posts

    Custom Error Handling

    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!

  • #2
    Regular Coder the-dream's Avatar
    Join Date
    Mar 2007
    Location
    Northamptonshire, UK
    Posts
    477
    Thanks
    8
    Thanked 4 Times in 4 Posts
    You could put the errors into a variable, then echo the variable out somewhere on the page!

  • #3
    New Coder
    Join Date
    Jan 2006
    Posts
    73
    Thanks
    2
    Thanked 3 Times in 3 Posts
    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.
    Last edited by xGIHavoc; 01-13-2008 at 11:08 PM.

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    • Throw a new exception, this will die if you don't catch the exceptions.
    • Customize your trigger by setting the error handler

    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •