b24581fff3eb64801b297ad8b3ad260d1c2cbd15
galt
  Thu May 4 02:23:26 2017 -0700
Added errCatch around bed validation which can errAbort. Minor tweak to textarea improves whitespace newline handling for BED input.

diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index 539caa6..c3bc347 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -4126,31 +4126,43 @@
 	}
     if (expectedFieldCount == -1)
 	{
 	expectedFieldCount = numFields;
 	}
     else
 	{
 	if (numFields != expectedFieldCount)
 	    errAbort("Multi-Region BED was detected to have %d columns. But this row has %d columns. "
 	    "All rows except comment lines should have the same number of columns", numFields, expectedFieldCount);
 	}
 
     AllocVar(bed);
     // All fields are standard BED fields, no bedplus fields supported at this time.
     // note: this function does not validate chrom name or end beyond chrom size
-    loadAndValidateBed(row, numFields, numFields+0, lf, bed, NULL, TRUE);
+    struct errCatch *errCatch = errCatchNew();
+    if (errCatchStart(errCatch))
+	{
+	loadAndValidateBed(row, numFields, numFields+0, lf, bed, NULL, TRUE); // can errAbort
+	}
+    errCatchEnd(errCatch);
+    if (errCatch->gotError)
+	{
+	warn("%s", errCatch->message->string);
+	return FALSE;
+	}
+    errCatchFree(&errCatch);
+
     bed->chrom=cloneString(bed->chrom);  // loadAndValidateBed does not do it for speed. but bedFree needs it.
 
     struct chromInfo *ci = hGetChromInfo(database, bed->chrom);
     if (ci == NULL)
 	{
         warn("Couldn't find chromosome/scaffold %s in database", bed->chrom);
 	return FALSE;
 	}
     if (bed->chromEnd > ci->size)
 	{
         warn("BED chromEnd %u > size %u for chromosome/scaffold %s", bed->chromEnd, ci->size, bed->chrom);
 	return FALSE;
 	}
 
     slAddHead(&bedList, bed);