adding sql error support.