870467bf9a07275e1e50faae952da0582c555907 kent Sat Aug 17 09:54:55 2019 -0700 Improving some error messages. diff --git src/tabFile/tabToTabDir/tabToTabDir.c src/tabFile/tabToTabDir/tabToTabDir.c index 0245f0f..aac3d2c 100644 --- src/tabFile/tabToTabDir/tabToTabDir.c +++ src/tabFile/tabToTabDir/tabToTabDir.c @@ -305,32 +305,33 @@ { struct fieldedRow *uniqFr = hashFindVal(uniqHash, key); if (uniqFr == NULL) { uniqFr = fieldedTableAdd(outTable, outRow, outFieldCount, 0); hashAdd(uniqHash, key, uniqFr); } else /* Do error checking for true uniqueness of key */ { int differentIx = firstDifferentIx(outRow, uniqFr->row, outFieldCount); if (differentIx >= 0) { warn("There is a problem with the key to table %s in %s", outTable->name, specFile); warn("%s %s", uniqFr->row[keyFieldIx], uniqFr->row[differentIx]); warn("%s %s", outRow[keyFieldIx], outRow[differentIx]); - errAbort("both exist, so key doesn't specify a unique %s field", + warn("both exist, so key doesn't specify a unique %s field", outTable->fields[differentIx]); + errAbort("line %d of %s", fr->id, inTable->name); } } } } dyStringFree(&csvScratch); } struct hash *hashFieldIx(char **fields, int fieldCount) /* Create a hash filled with fields with integer valued indexes */ { int i; struct hash *hash = hashNew(0); for (i=0; i<fieldCount; ++i) @@ -353,31 +354,34 @@ struct hash *varHash = hashNew(5); struct symRec *symbols = symRecNew(inFieldHash, varHash); symbols->tableRow = inTable->fields; // During parse pass fields will act as proxy for tableRow /* Open spec file, check first real line, and maybe start defining variables. */ /* Snoop for a define stanza first that'll hold our variables. */ struct lineFile *lf = lineFileOpen(specFile, TRUE); char *defLine; if (!lineFileNextReal(lf, &defLine)) errAbort("%s is empty", specFile); if (startsWithWord("define", defLine)) // Whee, we got vars! { char *varName, *varSpec; while (raNextTagVal(lf, &varName, &varSpec, NULL)) { - verbose(1, "var %s (%s)\n", varName, varSpec); + if (varSpec == NULL) + errAbort("Expecting expression for variable %s line %d of %s", varName, + lf->lineIx, lf->fileName); + verbose(2, "var %s (%s)\n", varName, varSpec); struct strexParse *exp = strexParseString(varSpec, lf->fileName, lf->lineIx-1, symbols, symLookup); struct varVal *v = varValNew(varName, exp); hashAdd(varHash, varName, v); slAddHead(&symbols->varList, v); } slReverse(&symbols->varList); } else lineFileReuse(lf); /* Read in rest of spec file as ra stanzas full of tables more or less */ struct newTableInfo *newTableList = NULL, *newTable; while (raSkipLeadingEmptyLines(lf, NULL))