Handle database excpetions