handle db errors