How to return database error from restful service?

I am writing both server and client side. If request is successful or have error like HTTP 404, 400, 405 etc... I can handle it without any problem. However, I dont know what is the best way to handle errors from database side. Like;