Contests arising out of primary elections shall be brought and determined in the same manner, as nearly as possible, as provided by law for contests of general elections.