IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 4, 2007, 9:55:03 AM (19 years ago)
Author:
eugene
Message:

clean up error handling on pmFPAfileIO

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psphot/src/psphotImageLoop.c

    r12805 r15216  
    11# include "psphotStandAlone.h"
     2
     3# define ESCAPE(MESSAGE) { \
     4  psError(PSPHOT_ERR_DATA, false, MESSAGE); \
     5  psFree (view); \
     6  return false; \
     7}
    28
    39bool psphotImageLoop (pmConfig *config) {
     
    2228   
    2329    // files associated with the science image
    24     if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {
    25         psError(PSPHOT_ERR_DATA, false, "failed IO for fpa in psphot\n");
    26         psFree(view);
    27         return false;
    28     }
     30    if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for fpa in psphot.");
    2931
    3032    // for psphot, we force data to be read at the chip level
     
    3840        pmFPAfileActivate (config->files, true, "PSPHOT.MASK");
    3941        pmFPAfileActivate (config->files, true, "PSPHOT.WEIGHT");
    40         if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {
    41             psError(PSPHOT_ERR_DATA, false, "failed IO for chip %d in psphot\n", view->chip);
    42             psFree (view);
    43             return false;
    44         }
     42        if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Chip in psphot.");
    4543
    4644        // mosaic the cells of a chip into a single contiguous (trimmed) chip
    47         if (!psphotMosaicChip(config, view, "PSPHOT.INPUT", "PSPHOT.LOAD")) {
    48             psError(PS_ERR_UNKNOWN, false, "Unable to mosaic chip.\n");
    49             return false;
    50         }
     45        if (!psphotMosaicChip(config, view, "PSPHOT.INPUT", "PSPHOT.LOAD")) ESCAPE ("Unable to mosaic chip.");
    5146
    5247        // try to load other supporting data (PSF, SRC, etc).
     
    5651        pmFPAfileActivate (config->files, false, "PSPHOT.MASK");
    5752        pmFPAfileActivate (config->files, false, "PSPHOT.WEIGHT");
    58         if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {
    59             psError(PSPHOT_ERR_DATA, false, "failed IO for chip %d in psphot\n", view->chip);
    60             psFree (view);
    61             return false;
    62         }
     53        if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) ESCAPE ("failed input for Chip in psphot.");
     54
    6355        // re-activate files so they will be closed and freed below
    6456        pmFPAfileActivate (config->files, true, NULL);
     
    8375
    8476        // save output which is saved at the chip level
    85         if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
    86             psError(PSPHOT_ERR_DATA, false, "failed IO for chip %d in psphot\n", view->chip);
    87             psFree (view);
    88             return false;
    89         }
     77        if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ("failed output for Chip in psphot.");
    9078    }
    9179    // save output which is saved at the fpa level
    92     if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
    93         psError(PSPHOT_ERR_DATA, false, "failed IO for fpa in psphot\n");
    94         psFree (view);
    95         return false;
    96     }
     80    if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) ESCAPE ("failed ouput for FPA in psphot.");
     81
     82    // fail if we failed to handle an error
     83    if (psErrorCodeLast() != PS_ERR_NONE) psAbort ("failed to handle an error!");
    9784
    9885    psFree (view);
    99 
    100     // fail if we failed to handle an error
    101     if (psErrorCodeLast() != PS_ERR_NONE) return false;
    10286    return true;
    10387}
Note: See TracChangeset for help on using the changeset viewer.