060c9d0ae2bf7b3333d76c15ee3b114c3278f519 braney Sat Oct 8 14:29:09 2011 -0700 check trackDb.txt files and hub.txt files more closely in hgHubConnect so errors can be discovered ASAP. #4679 and others. diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c index 9015da2..0ea81e0 100644 --- src/hg/hgHubConnect/hgHubConnect.c +++ src/hg/hgHubConnect/hgHubConnect.c @@ -232,31 +232,33 @@ printf( "" , url); ourCellEnd(); } else errAbort("cannot get id for hub with url %s\n", url); ourPrintCell(shortLabel); if (isEmpty(errorMessage)) ourPrintCell(longLabel); else - printf("ERROR: %s", errorMessage); + printf("ERROR: %s " + "Debug", + errorMessage); ourPrintCell(url); } } sqlFreeResult(&sr); if (gotAnyRows) { printf("\n"); } else { printf("
\n"); printf("No Public Track Hubs for this genome assembly
"); } @@ -313,30 +315,53 @@ static void doDisconnectHub(struct cart *theCart) { char *id = cartOptionalString(cart, "hubId"); if (id != NULL) { char buffer[1024]; safef(buffer, sizeof buffer, "hgHubConnect.hub.%s", id); cartRemove(cart, buffer); } cartRemove(theCart, "hubId"); } +static void checkTrackDbs(struct hubConnectStatus *hubList) +{ +struct hubConnectStatus *hub = hubList; +struct trackHub *trackHubList = NULL; + +for(; hub; hub = hub->next) + { + struct errCatch *errCatch = errCatchNew(); + if (errCatchStart(errCatch)) + { + trackHubAddTracks(hub->id, hub->hubUrl, database, &trackHubList); + } + errCatchEnd(errCatch); + if (errCatch->gotError) + { + hub->errorMessage = cloneString(errCatch->message->string); + hubUpdateStatus( errCatch->message->string, hub); + } + else + hubUpdateStatus(NULL, hub); + } +} + void doMiddle(struct cart *theCart) /* Write header and body of html page. */ { boolean gotDisconnect = FALSE; cart = theCart; setUdcCacheDir(); if (cartVarExists(cart, hgHubDoClear)) { doClearHub(cart); cartWebEnd(); return; } @@ -375,30 +400,32 @@ "User's Guide.

\n" "

NOTE: Because Track Hubs are created and maintained by external sources," " UCSC cannot be held responsible for their content.

" ); printf("
\n"); // figure out and print out genome name makeGenomePrint(); // check to see if we have any new hubs hubCheckForNew(database, cart); // grab all the hubs that are listed in the cart struct hubConnectStatus *hubList = hubConnectStatusListFromCartAll(cart); +checkTrackDbs(hubList); + // here's a little form for the add new hub button printf("
\n", "../cgi-bin/hgHubConnect"); cgiMakeHiddenVar("hubUrl", ""); cgiMakeHiddenVar(hgHubConnectRemakeTrackHub, "on"); puts("
"); // this the form for the disconnect hub button printf("
\n", "../cgi-bin/hgHubConnect"); cgiMakeHiddenVar("hubId", ""); cgiMakeHiddenVar(hgHubDoDisconnect, "on"); cgiMakeHiddenVar(hgHubConnectRemakeTrackHub, "on"); puts("
"); // this the form for the reset hub button printf("
\n", "../cgi-bin/hgHubConnect");