Will
Will

Reputation: 723

Graceful Handling of Technical PHP/SQL errors

I'm developing a PHP web application that is heavy on the database interactions. My question is, how do I display "Pretty" errors. I've got all kinds of exceptions and what not in pretty much every aspect of the app, but they still just awkwardly post the error text (which I currently have working perfectly) either above a half loaded page or on a blank, white background.

How do I go about rerouting these to a generic error page that has a nice, contained spot for inserting the error message so that clients and testers can communicate it to me.

My immediate guess would be to post these errors, but I don't know how to do that outside a form much less inside of a function.

Upvotes: 0

Views: 74

Answers (1)

Madara's Ghost
Madara's Ghost

Reputation: 174977

You're using exceptions, that's good.

You can prostpone all output using output buffering control, and display all errors condensed at the required area of the page.

The actual technique revolves around simply appending all of the errors into an $errors array and iterating through it displaying nice errors along the way.

Upvotes: 1

Related Questions