, Robert Bernier has started writing a series of articles on Postgres exception handling
. In this one, covers the basics of exception handling for PHP developers
Postgres exceptions are quite different from PHP exceptions; whereas PHP 5 uses the traditional "Try And Catch" format, Postgres exceptions can only be defined, executed and processed inside the body of the function that triggered the exception.
Also in the article
he covers RAISE statements, how Postgres handles them, and gives good practices on how to use them effectively as a method of troubleshooting errors.