The Spirit Posted February 13, 2014 Share Posted February 13, 2014 (edited) Whats your prefered way of dealing errors and in your opinion what way do you think is best practise? If you use both when do you use each? trigger_error() or throw new exception() or a custom error handler At the moment I deal with errors such as database or file handling errors through exceptions and user generator errors with a custom error handler A discussion on this topic may be interesting Edited February 13, 2014 by The Spirit Quote Link to comment Share on other sites More sharing options...
sniko Posted February 14, 2014 Share Posted February 14, 2014 For me, it depends. On dev/test systems, I let the errors flow by PHPs native error handler (verbose error reporting), so I can fix those errors - which are usually silly mistakes. On live, it depends what logic is talking place. For example; Connecting to a database - try/catch; send header response 500. Updating a row - try/catch; send header response 400/500/dependant on other variables. Syntax error - Custom error handler Debugging live - trigger_error/file_put_contents 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.