Throw proper messages on error.