src/hg/hgCustom/hgCustom.c 1.131

1.131 2009/08/19 18:58:13 angie
Added errCatch around customTracksParseCartDetailed (similar to that around customTrackUpdateFromConfig) because bad URL in doc input was causing abort.
Index: src/hg/hgCustom/hgCustom.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/hgCustom/hgCustom.c,v
retrieving revision 1.130
retrieving revision 1.131
diff -b -B -U 4 -r1.130 -r1.131
--- src/hg/hgCustom/hgCustom.c	5 Aug 2009 18:44:46 -0000	1.130
+++ src/hg/hgCustom/hgCustom.c	19 Aug 2009 18:58:13 -0000	1.131
@@ -1073,10 +1073,21 @@
             cartRemove(cart, hgCtDataFile);
             cartRemove(cart, hgCtDataFileName);
             }
         }
+    boolean ctParseError = FALSE;
+    struct errCatch *catch = errCatchNew();
+    if (errCatchStart(catch))
     ctList = customTracksParseCartDetailed(database, cart, &browserLines, &ctFileName,
 					    &replacedCts, NULL, &err);
+    errCatchEnd(catch);
+    if (catch->gotError)
+	{
+	addWarning(dsWarn, err);
+	addWarning(dsWarn, catch->message->string);
+	ctParseError = TRUE;
+	}
+    errCatchFree(&catch);
 
     /* exclude special setting used by table browser to indicate
      * db assembly for error-handling purposes only */
     char *db = NULL;
@@ -1146,8 +1157,10 @@
         customTracksSaveCart(database, cart, ctList);
     warn = dyStringCannibalize(&dsWarn);
     if (!initialDb || ctList || cartVarExists(cart, hgCtDoDelete))
         doManageCustom(warn);
+    else if (ctParseError)
+	doAddCustom(warn);
     else
         doAddCustom(NULL);
     }
 cartRemovePrefix(cart, hgCt);