CRM-11926 add a better error handling for db errors in the api
Merge pull request #5 from tttp/CRM-11926_upstream

CRM-11926 add a better error handling for db errors in the api