src/hg/lib/customFactory.c 1.102
1.102 2009/08/19 06:02:57 galt
fixing htmlUrl to handle net.c errAbort using errCatch
Index: src/hg/lib/customFactory.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/lib/customFactory.c,v
retrieving revision 1.101
retrieving revision 1.102
diff -b -B -U 4 -r1.101 -r1.102
--- src/hg/lib/customFactory.c 18 Aug 2009 22:31:14 -0000 1.101
+++ src/hg/lib/customFactory.c 19 Aug 2009 06:02:57 -0000 1.102
@@ -1,8 +1,9 @@
/* customFactory - a polymorphic object for handling
* creating various types of custom tracks. */
#include "common.h"
+#include "errCatch.h"
#include "hash.h"
#include "linefile.h"
#include "portable.h"
#include "obscure.h"
@@ -1674,15 +1675,20 @@
}
if ((val = hashFindVal(hash, "htmlUrl")) != NULL)
{
+ /* adding error trapping because various net.c functions can errAbort */
+ struct errCatch *errCatch = errCatchNew();
+ if (errCatchStart(errCatch))
+ {
struct dyString *ds = NULL;
int sd = netUrlOpen(val);
if (sd >= 0)
{
char *newUrl = NULL;
int newSd = 0;
- if (netSkipHttpHeaderLinesHandlingRedirect(sd, val, &newSd, &newUrl)) /* redirect can modify the url */
+ if (netSkipHttpHeaderLinesHandlingRedirect(sd, val, &newSd, &newUrl))
+ /* redirect can modify the url */
{
if (newUrl)
{
freeMem(newUrl);
@@ -1693,9 +1699,16 @@
track->tdb->html = dyStringCannibalize(&ds);
}
}
}
+ errCatchEnd(errCatch);
+ if (errCatch->gotError)
+ warn(errCatch->message->string);
+ errCatchFree(&errCatch);
+ }
+
tdb->url = hashFindVal(hash, "url");
+
if ((val = hashFindVal(hash, "visibility")) != NULL)
{
if (isdigit(val[0]))
{