title: PHP: How to manage errors gracefully?
body: <p>When failed to access something on the web (api, database), how would I stop executing the rest of the script and log the error in the log file? Well, and so that the visitor wouldn't see the exact cause but rather they would see my custom message (say, 'A bad thing just happened'). What steps do I need to take to arrange things?</p>