1. Learn
  2. /
  3. Courses
  4. /
  5. Transactions and Error Handling in PostgreSQL

Exercise

Logging messages on specific exceptions

One of the best uses of catching multiple specific exception is to distinctly handle and log unique error message that help you understand exactly why an exception occurred. Let's apply this in a scenario where both error conditions are possible. We'll discuss after the exercise why it capture the specific message it did.

Instructions

100 XP
  • Build an exception handler for a not_null_violation.
  • Insert "failed to insert" as the msg, Glucose can not be null. as the detail into the errors table if a not_null_violation occurs.