Catching errors in database entry