handle db exception