023255de913dda73eeceee882e1b5f824c94f34f
jcasper
  Tue Apr 18 10:52:42 2023 -0700
Need to catch errors on opening a hic file with Straw, because the
magic string check can also generate an exception.  refs #31071

diff --git src/hg/inc/cStraw.h src/hg/inc/cStraw.h
index 7a7a576..f77b255 100644
--- src/hg/inc/cStraw.h
+++ src/hg/inc/cStraw.h
@@ -1,34 +1,35 @@
 /* cStraw - a wrapper header file for making C++ functions associated with retrieving
  * data from .hic files available to C libraries.  The underlying functions come
  * from the Straw library by the Aiden Lab at the Broad Institute (see
  * kent/src/hg/lib/straw/).
 */
 #ifndef CSTRAW_H
 #define CSTRAW_H
 
 typedef struct Straw Straw;
 
-Straw *cStrawOpen (char *fname);
-/* Return a pointer to a Straw object for further operations (i.e. reads) */
+char *cStrawOpen (char *fname, Straw **p);
+/* Create a Straw object based on the hic file at the provided path and set *p to point to it.
+ * On error, set *p = NULL and return a non-null string describing the error. */
 
 Straw *cStrawClose (Straw **hicFile);
 /* Close out a Straw record, freeing the object */
 
 char* cStraw (Straw *hicFile, char *norm, int binsize, char *chr1loc, char *chr2loc, char *unit, int **xActual, int **yActual, double **counts, int *numRecords);
 /* Wrapper function to retrieve a data chunk from a .hic file, for use by C libraries.
  * norm is one of NONE/VC/VC_SQRT/KR.
  * binsize is one of the supported bin sizes as determined by cStrawHeader.
  * chr1loc and chr2loc are the two positions to retrieve interaction data for, specified as chr:start-end.
  * unit is one of BP/FRAG.
  * Values are returned in newly allocated arrays in xActual, yActual, and counts, with the number of
  * returned records in numRecords.
  * The function returns NULL unless an error was encountered, in which case the return value points
  * to a character string explaining the error. */
 
 char* cStrawHeader (Straw *hicFile, char **genome, char ***chromNames, int **chromSizes, int *nChroms, char ***bpResolutions, int *nBpRes, char ***fragResolutions, int *nFragRes, char ***attributes, int *nAttributes);
 /* Wrapper function to retrieve header fields from a .hic file, for use by C libraries.
  * This retrieves the assembly name, list of chromosome names, list of available binsize resolutions,
  * and list of available fragment resolutions in the specific .hic file.
  * The function returns NULL unless an error was encountered, in which case the return value points
  * to a character string explaining the error. */
 #endif