src/hg/lib/hgFind.c 1.219

1.219 2009/06/03 04:30:19 markd
don't dumps stacks on find errors; doing stack dump in abort handler rather than warn handler simplifies
Index: src/hg/lib/hgFind.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/hgFind.c,v
retrieving revision 1.218
retrieving revision 1.219
diff -b -B -U 4 -r1.218 -r1.219
--- src/hg/lib/hgFind.c	24 Feb 2009 22:34:08 -0000	1.218
+++ src/hg/lib/hgFind.c	3 Jun 2009 04:30:19 -0000	1.219
@@ -42,8 +42,25 @@
 static char *mrnaTables[] = { "all_mrna", "xenoMrna", NULL };
 static char *mrnaLabels[] = { "mRNAs", "Other mRNAs", NULL };
 static struct dyString *hgpMatchNames = NULL;
 
+void hgFindErr(char *format, ...)
+/* generate an find error, disabling logging stack dumps. */
+#if defined(__GNUC__)
+__attribute__((format(printf, 1, 2)))
+#endif
+;
+
+void hgFindErr(char *format, ...)
+/* generate an find error, disabling logging stack dumps. */
+{
+webDumpStackDisallow();
+va_list args;
+va_start(args, format);
+vaErrAbort(format, args);
+va_end(args);
+}
+
 static void hgPosFree(struct hgPos **pEl)
 /* Free up hgPos. */
 {
 struct hgPos *el;
@@ -950,9 +967,9 @@
 	break;
 	}
     }
 if (chrStart == NULL)
-    errAbort("Couldn't find chromosome %s in band list", chromosome);
+    hgFindErr("Couldn't find chromosome %s in band list", chromosome);
 
 /* Find last band in chromosome. */
 for (cb = chrStart->next; cb != NULL; cb = cb->next)
     {
@@ -1018,9 +1035,9 @@
 	return;
 	}
     s = strrchr(choppedBand, '.');
     if (s == NULL)
-	errAbort("Couldn't find anything like band '%s'", band);
+	hgFindErr("Couldn't find anything like band '%s'", band);
     else
 	{
 	e = choppedBand + strlen(choppedBand) - 1;
 	*e = 0;
@@ -2497,18 +2514,18 @@
 	{
 	hgPositionsFree(&hgp);
 	warn("Sorry, couldn't locate %s in genome database\n", htmlEncode(terms[i]));
 	if (multiTerm)
-	    errAbort("%s not uniquely determined -- "
+	    hgFindErr("%s not uniquely determined -- "
 		     "can't do multi-position search.", terms[i]);
 	*retWinStart = 0;
 	return NULL;
 	}
     
     if ((hgp->singlePos != NULL) && (!showAlias || !hgp->useAlias))
 	{
 	if (chrom != NULL && !sameString(chrom, hgp->singlePos->chrom))
-	    errAbort("Sites occur on different chromosomes: %s, %s.",
+	    hgFindErr("Sites occur on different chromosomes: %s, %s.",
 		     chrom, hgp->singlePos->chrom);
 	chrom = hgp->singlePos->chrom;
 	if (hgp->singlePos->chromStart < start)
 	    start = hgp->singlePos->chromStart;
@@ -2518,9 +2535,9 @@
     else
 	{
 	hgPositionsHtml(db, hgp, stdout, useWeb, hgAppName, cart);
 	if (multiTerm && hgp->posCount != 1)
-	    errAbort("%s not uniquely determined (%d locations) -- "
+	    hgFindErr("%s not uniquely determined (%d locations) -- "
 		     "can't do multi-position search.",
 		     terms[i], hgp->posCount);
 	*retWinStart = hgp->posCount;
 	hgp = NULL;
@@ -2572,9 +2589,9 @@
 static void noRelative(boolean relativeFlag, int relStart, int relEnd,
 		       char *table)
 {
 if (relativeFlag)
-    errAbort("Sorry, range spec (\":%d-%d\") is not supported for %s.",
+    hgFindErr("Sorry, range spec (\":%d-%d\") is not supported for %s.",
 	     relStart+1, relEnd, table);
 
 }
 #endif
@@ -2903,9 +2920,9 @@
         sameString("chr23", *term) || startsWith("chr23:", *term))
         {
         *term = hDefaultPos(hgp->database);
         if (endsWith(hgAppName, "hgTables"))
-            errAbort(msg);
+            hgFindErr(msg);
         else
             warn(msg);
         return TRUE;
         }