handle database excpetions