Migrates the ContainsOnly method to the new error format messages.