db: add clearer error handeling

Signed-off-by: Niv Sardi <xaiki@evilgiggle.com>