Changeset 7311 for trunk/psModules/src/camera/pmFPAConstruct.c
- Timestamp:
- Jun 2, 2006, 3:02:08 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/camera/pmFPAConstruct.c (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/camera/pmFPAConstruct.c
r7278 r7311 26 26 bool status = true; // Result of MD lookup 27 27 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"); 30 30 return NULL; 31 31 } … … 114 114 } 115 115 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); 118 118 return NULL; 119 119 } … … 138 138 fpa->hdu = psMemIncrRefCounter(hdu); 139 139 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 } 141 144 } 142 145 pmFPASetFileStatus(fpa, true); … … 256 259 257 260 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 } 259 265 } 260 266 … … 333 339 } 334 340 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 } 336 345 numCells++; 337 346 } … … 388 397 bool mdok = true; // Status from MD lookups 389 398 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 } 390 404 psMetadataIterator *componentsIter = psMetadataIteratorAlloc(components, PS_LIST_HEAD, NULL); 391 405 psMetadataItem *componentsItem = NULL; // Item from components … … 500 514 hdu->format = psMemIncrRefCounter(format); 501 515 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 } 503 523 psFree(hdu); 504 524 } … … 568 588 if (!mdok || !contents || strlen(contents) == 0) { 569 589 psError(PS_ERR_IO, true, "Unable to find CONTENTS in the camera format configuration.\n"); 590 psFree(phdu); 570 591 psFree(view); 571 592 return NULL; 572 593 } 573 594 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 575 603 psFree(phdu); 576 604 return view; … … 581 609 psMetadata *contents = psMetadataLookupMD(&mdok, format, "CONTENTS"); // The contents of the FITS file 582 610 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 584 621 psFree(view); 585 622 return NULL;
Note:
See TracChangeset
for help on using the changeset viewer.
