IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 2, 2006, 3:02:08 PM (20 years ago)
Author:
Paul Price
Message:

Applying RHL patch. Generally improves the error handling and traceback. pmConcepts.c and pmConceptsRead.c done by PAP (RHL did this also, but I had already done them). Resolved conflicts, except for pmFPAfile.c, which uses psAbort in some instances where RHL's patch had psError; leave this for Gene to decide.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAConstruct.c

    r7278 r7311  
    2626    bool status = true;                 // Result of MD lookup
    2727    psMetadata *cells = psMetadataLookupMD(&status, format, "CELLS"); // The CELLS
    28     if (! status) {
    29         psError(PS_ERR_IO, false, "Unable to determine CELLS of camera.\n");
     28    if (!status || !cells) {
     29        psError(PS_ERR_IO, true, "Unable to determine CELLS of camera.\n");
    3030        return NULL;
    3131    }
     
    114114    }
    115115    psMetadataItem *resultItem = psMetadataLookup(header, keyword);
    116     if (! resultItem) {
    117         psError(PS_ERR_IO, false, "Unable to find %s in primary header to identify %s.\n", keyword, name);
     116    if (!resultItem) {
     117        psError(PS_ERR_IO, true, "Unable to find %s in primary header to identify %s.\n", keyword, name);
    118118        return NULL;
    119119    }
     
    138138    fpa->hdu = psMemIncrRefCounter(hdu);
    139139    if (hdu->header) {
    140         pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_HEADER, NULL);
     140        if (!pmConceptsReadFPA(fpa, PM_CONCEPT_SOURCE_HEADER, NULL)) {
     141            psError(PS_ERR_UNKNOWN, false, "Failed to read concepts for FPA");
     142            return false;
     143        }
    141144    }
    142145    pmFPASetFileStatus(fpa, true);
     
    256259
    257260    if (hdu && level == PM_FPA_LEVEL_FPA) {
    258         addHDUtoFPA(fpa, hdu);
     261        if (!addHDUtoFPA(fpa, hdu)) {
     262            psError(PS_ERR_UNKNOWN, false, "Adding HDU to FPA (%s)", contents);
     263            return -1;
     264        }
    259265    }
    260266
     
    333339        }
    334340        newCell->config = psMemIncrRefCounter(cellData);
    335         pmConceptsReadCell(newCell, PM_CONCEPT_SOURCE_CAMERA | PM_CONCEPT_SOURCE_DEFAULTS, false, NULL);
     341        if (!pmConceptsReadCell(newCell, PM_CONCEPT_SOURCE_CAMERA | PM_CONCEPT_SOURCE_DEFAULTS, false, NULL)) {
     342            psError(PS_ERR_IO, false, "Reading concepts for cell %d", numCells);
     343            return -1;
     344        }
    336345        numCells++;
    337346    }
     
    388397    bool mdok = true;                   // Status from MD lookups
    389398    psMetadata *components = psMetadataLookupMD(&mdok, camera, "FPA"); // FPA components
     399    if (!mdok || !components) {
     400        psError(PS_ERR_IO, true, "Failed to lookup \"FPA\"");
     401        psFree(fpa);
     402        return NULL;
     403    }
    390404    psMetadataIterator *componentsIter = psMetadataIteratorAlloc(components, PS_LIST_HEAD, NULL);
    391405    psMetadataItem *componentsItem = NULL; // Item from components
     
    500514        hdu->format = psMemIncrRefCounter(format);
    501515        const char *content = contentsItem->data.V; // The content data
    502         processContents(fpa, chip, cell, hdu, level, content, format);
     516        if (processContents(fpa, chip, cell, hdu, level, content, format) < 0) {
     517            psError(PS_ERR_IO, false, "Error setting contents for %s", contentsItem->name);
     518            psFree(hdu);
     519            psFree(contentsIter);
     520
     521            return false;
     522        }
    503523        psFree(hdu);
    504524    }
     
    568588        if (!mdok || !contents || strlen(contents) == 0) {
    569589            psError(PS_ERR_IO, true, "Unable to find CONTENTS in the camera format configuration.\n");
     590            psFree(phdu);
    570591            psFree(view);
    571592            return NULL;
    572593        }
    573594
    574         processContents(fpa, NULL, NULL, phdu, PM_FPA_LEVEL_FPA, contents, format);
     595        if (processContents(fpa, NULL, NULL, phdu, PM_FPA_LEVEL_FPA, contents, format) < 0) {
     596            psError(PS_ERR_IO, false, "Error setting CONTENTS");
     597            psFree(phdu);
     598            psFree(view);
     599
     600            return NULL;
     601        }
     602
    575603        psFree(phdu);
    576604        return view;
     
    581609    psMetadata *contents = psMetadataLookupMD(&mdok, format, "CONTENTS"); // The contents of the FITS file
    582610    if (!mdok || !contents) {
    583         psError(PS_ERR_IO, false, "Unable to find CONTENTS in the camera format configuration.\n");
     611        if (mdok && !contents) {
     612            psError(PS_ERR_IO, true, "CONTENTS metadata is NULL in the camera format configuration.");
     613        } else {
     614            if(psMetadataLookup(format, "CONTENTS") != NULL) {
     615                psError(PS_ERR_IO, true, "CONTENTS is of wrong type in camera format configuration");
     616            } else {
     617                psError(PS_ERR_IO, true, "Unable to find CONTENTS in the camera format configuration.");
     618            }
     619        }
     620
    584621        psFree(view);
    585622        return NULL;
Note: See TracChangeset for help on using the changeset viewer.