5ffc6ca0715fb74da342edad1cc78e8e1e597173
galt
  Mon Jan 31 00:40:59 2011 -0800
adding code to ignore already failed hubs and to detect and update the status of new hub failures
diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index 2a80e1f..6a73fd2 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -42,30 +42,31 @@
 #include "trackHub.h"
 #include "hubConnect.h"
 #include "cytoBand.h"
 #include "ensFace.h"
 #include "liftOver.h"
 #include "pcrResult.h"
 #include "wikiLink.h"
 #include "jsHelper.h"
 #include "mafTrack.h"
 #include "hgConfig.h"
 #include "encode.h"
 #include "agpFrag.h"
 #include "imageV2.h"
 #include "suggest.h"
 #include "searchTracks.h"
+#include "errCatch.h"
 
 static char const rcsid[] = "$Id: doMiddle.c,v 1.1651 2010/06/11 17:53:06 larrym Exp $";
 
 /* These variables persist from one incarnation of this program to the
  * next - living mostly in the cart. */
 boolean baseShowPos;           /* TRUE if should display full position at top of base track */
 boolean baseShowAsm;           /* TRUE if should display assembly info at top of base track */
 boolean baseShowScaleBar;      /* TRUE if should display scale bar at very top of base track */
 boolean baseShowRuler;         /* TRUE if should display the basic ruler in the base track (default) */
 char *baseTitle = NULL;        /* Title it should display top of base track (optional)*/
 static char *userSeqString = NULL;  /* User sequence .fa/.psl file. */
 
 /* These variables are set by getPositionFromCustomTracks() at the very
  * beginning of tracksDisplay(), and then used by loadCustomTracks(). */
 char *ctFileName = NULL;    /* Custom track file. */
@@ -3328,31 +3329,54 @@
 	tdbList = trackDbPolishAfterLinkup(tdbList, database);
 	trackDbPrioritizeContainerItems(tdbList);
 	addTdbListToTrackList(tdbList, NULL, pTrackList);
 	if (tdbList != NULL)
 	    slAddHead(pHubList, hub);
 	}
     }
 }
 
 void loadTrackHubs(struct track **pTrackList, struct trackHub **pHubList)
 /* Load up stuff from data hubs and append to lists. */
 {
 struct hubConnectStatus *hub, *hubList =  hubConnectStatusListFromCart(cart);
 for (hub = hubList; hub != NULL; hub = hub->next)
     {
+    if (isEmpty(hub->errorMessage))
+	{
+
+        /* error catching in so it won't just abort  */
+        struct errCatch *errCatch = errCatchNew();
+        if (errCatchStart(errCatch))
     addTracksFromTrackHub(hub->id, hub->hubUrl, pTrackList, pHubList);
+        errCatchEnd(errCatch);
+        if (errCatch->gotError)
+	    {
+	    struct sqlConnection *conn = hConnectCentral();
+	    char query[256];
+	    safef(query, sizeof(query),
+		"update %s set errorMessage=\"%s\", lastNotOkTime=now() where id=%d"
+		, hubConnectTableName
+		, errCatch->message->string
+		, hub->id
+		);
+	    sqlUpdate(conn, query);
+	    hDisconnectCentral(&conn);
+	    }
+        errCatchFree(&errCatch);
+
+	}
     }
 hubConnectStatusFreeList(&hubList);
 }
 
 boolean restrictionEnzymesOk()
 /* Check to see if it's OK to do restriction enzymes. */
 {
 return (hTableExists("hgFixed", "cutters") &&
     hTableExists("hgFixed", "rebaseRefs") &&
     hTableExists("hgFixed", "rebaseCompanies"));
 }
 
 void fr2ScaffoldEnsemblLink(char *archive)
 /* print out Ensembl link to appropriate scaffold there */
 {