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/concepts/pmConceptsRead.c

    r7280 r7311  
    7171        parsed = parsePlain(concept, spec->blank);
    7272    }
    73     if (!parsed)
    74         return false;
     73    if (!parsed) {
     74        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to parse concept %s\n", spec->blank->name);
     75        return false;
     76    }
    7577
    7678    // Plug the parsed concept into a new psMetadataItem, so each "concept" has its own version that can
     
    117119
    118120    pmHDU *hdu = pmHDUGetLowest(NULL, NULL, cell); // The HDU at the lowest level
    119     if (! hdu) {
     121    if (!hdu) {
    120122        return false;
    121123    }
     
    124126    psMetadataIterator *specsIter = psMetadataIteratorAlloc(specs, PS_LIST_HEAD, NULL); // Iterator
    125127    psMetadataItem *specItem = NULL;    // Item from the specs metadata
     128    bool status = true;                 // Status of reading concepts
    126129    while ((specItem = psMetadataGetAndIncrement(specsIter))) {
    127130        pmConceptSpec *spec = specItem->data.V; // The specification
    128131        psString name = specItem->name; // The concept name
    129132        psMetadataItem *conceptItem = psMetadataLookup(cellConfig, name); // The concept, or NULL
    130         psMetadataItem *value = NULL; // The value of the concept
    131133        if (conceptItem) {
    132134            if (conceptItem->type == PS_DATA_STRING) {
     
    138140                psFree(nameSource);
    139141                if (mdok && strlen(source) > 0 && strcasecmp(source, "VALUE") == 0) {
    140                     value = conceptItem;
    141                     conceptParse(spec, value, cameraFormat, target, NULL, NULL, cell);
     142                    if (!conceptParse(spec, conceptItem, cameraFormat, target, NULL, NULL, cell)) {
     143                        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to parse concept %s from camera "
     144                                "configuration\n", name);
     145                        status = false;
     146                    }
    142147                } else if (source && (strlen(source) == 0 || strcasecmp(source, "HEADER") != 0)) {
    143148                    // We leave "HEADER" to pmConceptsReadFromHeader
     
    148153            } else {
    149154                // Another type --- should be OK
    150                 conceptParse(spec, conceptItem, cameraFormat, target, NULL, NULL, cell);
     155                if (!conceptParse(spec, conceptItem, cameraFormat, target, NULL, NULL, cell)) {
     156                    psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to parse concept %s from camera "
     157                            "configuration.  It has a weird %s.SOURCE: %s\n", name, name);
     158                    status = false;
     159                }
    151160            }
    152161        }
    153162    }
    154163    psFree(specsIter);
    155     return true;
     164    return status;
    156165}
    157166
     
    179188    psMetadataIterator *specsIter = psMetadataIteratorAlloc(specs, PS_LIST_HEAD, NULL); // Iterator
    180189    psMetadataItem *specItem = NULL;    // Item from the specs metadata
     190    bool status = true;                 // Status of reading concepts
    181191    while ((specItem = psMetadataGetAndIncrement(specsIter))) {
    182192        pmConceptSpec *spec = specItem->data.V; // The specification
    183193        psString name = specItem->name; // The concept name
    184194        psMetadataItem *conceptItem = psMetadataLookup(defaults, name); // The concept, or NULL
    185         conceptParse(spec, conceptItem, cameraFormat, target, fpa, chip, cell);
     195        if (conceptItem && !conceptParse(spec, conceptItem, cameraFormat, target, fpa, chip, cell)) {
     196            psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to parse concept %s from DEFAULTS.\n", name);
     197            status = false;
     198        }
    186199    }
    187200    psFree(specsIter);
    188     return true;
     201    return status;
    189202}
    190203
     
    213226    psMetadataIterator *specsIter = psMetadataIteratorAlloc(specs, PS_LIST_HEAD, NULL); // Iterator
    214227    psMetadataItem *specItem = NULL;    // Item from the specs metadata
     228    bool status = true;                 // Status of reading concepts
    215229    while ((specItem = psMetadataGetAndIncrement(specsIter))) {
    216230        pmConceptSpec *spec = specItem->data.V; // The specification
     
    257271
    258272        // This will also clean up the name
    259         conceptParse(spec, headerItem, cameraFormat, target, fpa, chip, cell);
     273        if (headerItem && !conceptParse(spec, headerItem, cameraFormat, target, fpa, chip, cell)) {
     274            psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to parse concept %s from header.\n", name);
     275            status = false;
     276        }
    260277    }
    261278    psFree(specsIter);
    262     return true;
     279    return status;
    263280}
    264281
     
    294311    psMetadataIterator *specsIter = psMetadataIteratorAlloc(specs, PS_LIST_HEAD, NULL); // Iterator
    295312    psMetadataItem *specItem = NULL;    // Item from the specs metadata
     313    bool status = true;                 // Status of reading concepts
    296314    while ((specItem = psMetadataGetAndIncrement(specsIter))) {
    297315        pmConceptSpec *spec = specItem->data.V; // The specification
     
    374392
    375393                    // Now we have the result
    376                     conceptParse(spec, conceptItem, cameraFormat, target, fpa, chip, cell);
     394                    if (!conceptParse(spec, conceptItem, cameraFormat, target, fpa, chip, cell)) {
     395                        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to parse concept %s from database.\n",
     396                                name);
     397                        status = false;
     398                    }
    377399
    378400                }
     
    385407    psFree(specsIter);
    386408
    387     return true;
     409    return status;
    388410    #endif
    389411}
Note: See TracChangeset for help on using the changeset viewer.