IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27101


Ignore:
Timestamp:
Feb 25, 2010, 6:16:46 PM (16 years ago)
Author:
Paul Price
Message:

Being better about errors when reading/writing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pswarp/src/pswarpLoop.c

    r27096 r27101  
    3939{
    4040    pmFPAview *view = pmFPAviewAlloc(0); ///< View for checking
    41     bool status = true;                 ///< Status of checks
    42     status &= pmFPAfileIOChecks(config, view, PM_FPA_BEFORE);
     41    if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
     42        psFree(view);
     43        return false;
     44    }
    4345    view->chip = 0;
    44     status &= pmFPAfileIOChecks(config, view, PM_FPA_BEFORE);
     46    if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
     47        psFree(view);
     48        return false;
     49    }
    4550    view->cell = 0;
    46     status &= pmFPAfileIOChecks(config, view, PM_FPA_BEFORE);
     51    if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
     52        psFree(view);
     53        return false;
     54    }
    4755    psFree(view);
    48     return status;
     56    return true;
    4957}
    5058
     
    5765    pmFPAview *view = pmFPAviewAlloc(0); ///< View for checking
    5866    view->chip = view->cell = 0;
    59     bool status = true;                 ///< Status of checks
    60     status &= pmFPAfileIOChecks(config, view, PM_FPA_AFTER);
     67    if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
     68        psFree(view);
     69        return false;
     70    }
    6171    view->cell = -1;
    62     status &= pmFPAfileIOChecks(config, view, PM_FPA_AFTER);
     72    if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
     73        psFree(view);
     74        return false;
     75    }
    6376    view->chip = -1;
    64     status &= pmFPAfileIOChecks(config, view, PM_FPA_AFTER);
     77    if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
     78        psFree(view);
     79        return false;
     80    }
    6581    psFree(view);
    66     return status;
     82    return true;
    6783}
    6884
     
    151167        fileActivation(config, independentFiles, false);
    152168        fileActivation(config, skycellFiles, true);
    153         ioChecksBefore(config);
     169        if (!ioChecksBefore(config)) {
     170            psError(psErrorCodeLast(), false, "Unable to read files.");
     171            return false;
     172        }
    154173        fileActivation(config, skycellFiles, false);
    155174    }
     
    162181        pmChip *chip;
    163182        pmFPAview *view = pmFPAviewAlloc(0);
    164         if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {
     183        if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
     184            psError(psErrorCodeLast(), false, "Unable to read files.");
    165185            return false;
    166186        }
     
    169189            if (!chip->process || !chip->file_exists) { continue; }
    170190            if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
     191                psError(psErrorCodeLast(), false, "Unable to read files.");
    171192                return false;
    172193            }
     
    177198                if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE) ||
    178199                    !pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
     200                    psError(psErrorCodeLast(), false, "Unable to read files.");
    179201                    return false;
    180202                }
    181203            }
    182204            if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
     205                psError(psErrorCodeLast(), false, "Unable to write files.");
    183206                return false;
    184207            }
    185208        }
    186209        if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
     210            psError(psErrorCodeLast(), false, "Unable to write files.");
    187211            return false;
    188212        }
     
    222246    // files associated with the science image
    223247    if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {
     248        psError(psErrorCodeLast(), false, "Unable to read files.");
    224249        return false;
    225250    }
     
    230255        if (!chip->process || !chip->file_exists) { continue; }
    231256        if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {
     257            psError(psErrorCodeLast(), false, "Unable to read files.");
    232258            return false;
    233259        }
     
    257283            if (!cell->process || !cell->file_exists) { continue; }
    258284            if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {
     285                psError(psErrorCodeLast(), false, "Unable to read files.");
    259286                return false;
    260287            }
     
    266293            while ((readout = pmFPAviewNextReadout(view, input->fpa, 1)) != NULL) {
    267294                if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
     295                    psError(psErrorCodeLast(), false, "Unable to read files.");
    268296                    return false;
    269297                }
     
    283311
    284312                if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
     313                    psError(psErrorCodeLast(), false, "Unable to write files.");
    285314                    return false;
    286315                }
    287316            }
    288317            if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
     318                psError(psErrorCodeLast(), false, "Unable to write files.");
    289319                return false;
    290320            }
    291321        }
    292322        if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
     323            psError(psErrorCodeLast(), false, "Unable to write files.");
    293324            return false;
    294325        }
     
    404435
    405436    if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
     437        psError(psErrorCodeLast(), false, "Unable to write files.");
    406438        return false;
    407439    }
     
    416448    if (psMetadataLookupBool(&mdok, recipe, "PSF")) {
    417449        fileActivation(config, photFiles, true);
    418         ioChecksBefore(config);
     450        if (!ioChecksBefore(config)) {
     451            psError(psErrorCodeLast(), false, "Unable to read files.");
     452            return false;
     453        }
    419454
    420455        // supply the readout and fpa of interest to psphot
     
    501536    fileActivation(config, independentFiles, true);
    502537    fileActivation(config, skycellFiles, true);
    503     ioChecksAfter(config);
     538    if (!ioChecksAfter(config)) {
     539        psError(psErrorCodeLast(), false, "Unable to write files.");
     540        return false;
     541    }
    504542
    505543    // Write out summary statistics
Note: See TracChangeset for help on using the changeset viewer.