35104810b1eefd07d38383abefe90c24553cc146 angie Fri Dec 1 09:48:55 2023 -0800 When loading of existing custom tracks fails, do not attempt to merge new custom tracks because we will lose all existing custom tracks. Leave the settings in the cart for next time. (forgot to include this in previous commit) refs #32627 diff --git src/hg/lib/customTrack.c src/hg/lib/customTrack.c index 74dac69..b1e00dc 100644 --- src/hg/lib/customTrack.c +++ src/hg/lib/customTrack.c @@ -883,46 +883,53 @@ /* the 'ctfile_$db' variable contains a filename from the trash directory. * The file is created by hgCustom or hgTables after the custom track list * is created. The filename may be reused. The file contents are * custom tracks in "internal format" that have already been parsed */ char *ctFileName = NULL; struct customTrack *ctList = NULL, *replacedCts = NULL; struct customTrack *nextCt = NULL; boolean removedCt = FALSE; /* load existing custom tracks from trash file */ boolean changedCt = FALSE; if (customTracksExist(cart, &ctFileName)) { /* protect against corrupted CT trash file or table, or transient system error */ + boolean loadFailed = FALSE; struct errCatch *errCatch = errCatchNew(); if (errCatchStart(errCatch)) { ctList = customFactoryParse(genomeDb, ctFileName, TRUE, retBrowserLines); } errCatchEnd(errCatch); if (errCatch->gotError) { warn("Custom track loading error (%s): failed to load custom tracks. " "This is an internal error. If you want us to look into it and fix your custom track, " "please reach out to genome-www@soe.ucsc.edu and send us a session link " "where this error occurs", errCatch->message->string); + loadFailed = TRUE; } errCatchFree(&errCatch); + // If there was a failure in loading the custom tracks, return immediately -- don't try to + // add or merge in new custom tracks. The cartRemove statements below will be skipped, so we + // can try again next click. + if (loadFailed) + return NULL; /* handle selected tracks -- update doc, remove, etc. */ char *selectedTable = NULL; if (cartVarExists(cart, CT_DO_REMOVE_VAR)) selectedTable = cartOptionalString(cart, CT_SELECTED_TABLE_VAR); else selectedTable = cartOptionalString(cart, CT_UPDATED_TABLE_VAR); if (selectedTable) { for (ct = ctList; ct != NULL; ct = nextCt) { nextCt = ct->next; if (sameString(selectedTable, ct->tdb->track)) { if (cartVarExists(cart, CT_DO_REMOVE_VAR))