Do not leak SQL queries in HTTP 409 (conflict)

Log the exception details for debugging purposes when a SQL conflict
exception occurs when using the handle_conflicts decorator. Make
sure the raw sql queries do not get passed back to the end user.

Change-Id: If1ea528f0f9e486258d73b239015f370de2353ca
Closes-Bug: #1321804
Merge "Do not leak SQL queries in HTTP 409 (conflict)"