[FIX] use 500 for api errors

402 for requestFailed has been phased out
[TASK] introduce DatabaseError

for communicating errors on the database level