IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 17, 2010, 5:36:13 PM (16 years ago)
Author:
Paul Price
Message:

Being better about errors and their mapping to exit codes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppSub/src/ppSubCamera.c

    r26899 r26982  
    4545
    4646    if (!status) {
    47         psError(PS_ERR_UNKNOWN, false, "Failed to load file definition for %s", filerule);
     47        psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule);
    4848        return false;
    4949    }
     
    5252        file = pmFPAfileDefineFromRun(&status, bind, config, filerule); // File to return
    5353        if (!status) {
    54             psError(PS_ERR_UNKNOWN, false, "Failed to load file definition for %s", filerule);
     54            psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule);
    5555            return NULL;
    5656        }
     
    6464
    6565    if (file->type != fileType) {
    66         psError(PS_ERR_UNKNOWN, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType));
     66        psError(PPSUB_ERR_CONFIG, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType));
    6767        return NULL;
    6868    }
     
    8484        pmFPAfileDefineOutput(config, template->fpa, filerule);
    8585    if (!file) {
    86         psError(PS_ERR_IO, false, _("Unable to generate output file from %s"), filerule);
     86        psError(psErrorCodeLast(), false, _("Unable to generate output file from %s"), filerule);
    8787        return NULL;
    8888    }
    8989    if (file->type != fileType) {
    90         psError(PS_ERR_IO, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType));
     90        psError(PPSUB_ERR_CONFIG, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType));
    9191        return NULL;
    9292    }
     
    109109    pmFPAfile *file = pmFPAfileDefineFromRun(&status, bind, config, filerule); // File to return
    110110    if (!status) {
    111         psError(PS_ERR_UNKNOWN, false, "Failed to load file definition for %s", filerule);
     111        psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule);
    112112        return NULL;
    113113    }
     
    121121        file = pmFPAfileDefineOutput(config, bind ? bind->fpa : NULL, filerule);
    122122        if (!status) {
    123             psError(PS_ERR_UNKNOWN, false, "Failed to load file definition for %s", filerule);
     123            psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule);
    124124            return false;
    125125        }
     
    135135
    136136    if (file->type != fileType) {
    137         psError(PS_ERR_UNKNOWN, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType));
     137        psError(PPSUB_ERR_CONFIG, true, "%s is not of type %s", filerule, pmFPAfileStringFromType(fileType));
    138138        return NULL;
    139139    }
     
    154154    pmFPAfile *input = defineInputFile(&success, config, NULL, "PPSUB.INPUT", "INPUT", PM_FPA_FILE_IMAGE);
    155155    if (!success) {
    156         psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT");
     156        psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.INPUT");
    157157        return false;
    158158    }
     
    160160    defineInputFile(&success, config, input, "PPSUB.INPUT.MASK", "INPUT.MASK", PM_FPA_FILE_MASK);
    161161    if (!success) {
    162         psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT.MASK");
     162        psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.INPUT.MASK");
    163163        return false;
    164164    }
     
    166166    pmFPAfile *inVar = defineInputFile(&success, config, input, "PPSUB.INPUT.VARIANCE", "INPUT.VARIANCE", PM_FPA_FILE_VARIANCE);
    167167    if (!success) {
    168         psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT.VARIANCE");
     168        psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.INPUT.VARIANCE");
    169169        return false;
    170170    }
     
    172172    defineInputFile(&success, config, NULL, "PPSUB.INPUT.SOURCES", "INPUT.SOURCES", PM_FPA_FILE_CMF);
    173173    if (!success) {
    174         psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT.SOURCES");
     174        psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.INPUT.SOURCES");
    175175        return false;
    176176    }
     
    179179    pmFPAfile *ref = defineInputFile(&success, config, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE);
    180180    if (!success) {
    181         psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF");
     181        psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF");
    182182        return false;
    183183    }
     
    185185    defineInputFile(&success, config, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK);
    186186    if (!success) {
    187         psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF.MASK");
     187        psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.MASK");
    188188        return false;
    189189    }
     
    191191    pmFPAfile *refVar = defineInputFile(&success, config, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", PM_FPA_FILE_VARIANCE);
    192192    if (!success) {
    193         psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF.VARIANCE");
     193        psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.VARIANCE");
    194194        return false;
    195195    }
     
    197197    defineInputFile(&success, config, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF);
    198198    if (!success) {
    199         psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF.SOURCES");
     199        psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.SOURCES");
    200200        return false;
    201201    }
     
    204204    psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes, PPSUB_RECIPE); // Recipe for ppSim
    205205    if (!recipe) {
    206         psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find recipe %s", PPSUB_RECIPE);
     206        psError(PPSUB_ERR_CONFIG, false, "Unable to find recipe %s", PPSUB_RECIPE);
    207207        return false;
    208208    }
     
    227227                                             PM_FPA_FILE_MASK);
    228228    if (!inConvImage || !inConvMask) {
    229         psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
     229        psError(psErrorCodeLast(), false, "Unable to define output files");
    230230        return false;
    231231    }
     
    238238                                                PM_FPA_FILE_VARIANCE);
    239239        if (!inConvVar) {
    240             psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
     240            psError(psErrorCodeLast(), false, "Unable to define output files");
    241241            return false;
    242242        }
     
    251251                                              PM_FPA_FILE_MASK);
    252252    if (!refConvImage || !refConvMask) {
    253         psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
     253        psError(psErrorCodeLast(), false, "Unable to define output files");
    254254        return false;
    255255    }
     
    262262                                                 PM_FPA_FILE_VARIANCE);
    263263        if (!refConvVar) {
    264             psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
     264            psError(psErrorCodeLast(), false, "Unable to define output files");
    265265            return false;
    266266        }
     
    274274    pmFPAfile *outMask = defineOutputFile(config, output, false, "PPSUB.OUTPUT.MASK", PM_FPA_FILE_MASK);
    275275    if (!output || !outMask) {
    276         psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
     276        psError(psErrorCodeLast(), false, "Unable to define output files");
    277277        return false;
    278278    }
     
    283283                                             PM_FPA_FILE_VARIANCE);
    284284        if (!outVar) {
    285             psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
     285            psError(psErrorCodeLast(), false, "Unable to define output files");
    286286            return false;
    287287        }
     
    296296                                              PM_FPA_FILE_MASK);
    297297        if (!inverse || !invMask) {
    298             psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
     298            psError(psErrorCodeLast(), false, "Unable to define output files");
    299299            return false;
    300300        }
     
    305305                                                 PM_FPA_FILE_VARIANCE);
    306306            if (!invVar) {
    307                 psError(PS_ERR_UNKNOWN, false, "Unable to define output files");
     307                psError(psErrorCodeLast(), false, "Unable to define output files");
    308308                return false;
    309309            }
     
    316316    pmFPAfile *jpeg1 = pmFPAfileDefineOutput(config, NULL, "PPSUB.OUTPUT.JPEG1");
    317317    if (!jpeg1) {
    318         psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT.JPEG1"));
     318        psError(psErrorCodeLast(), false, _("Unable to generate output file from PPSUB.OUTPUT.JPEG1"));
    319319        return false;
    320320    }
    321321    if (jpeg1->type != PM_FPA_FILE_JPEG) {
    322         psError(PS_ERR_IO, true, "PPSUB.OUTPUT.JPEG1 is not of type JPEG");
     322        psError(psErrorCodeLast(), true, "PPSUB.OUTPUT.JPEG1 is not of type JPEG");
    323323        return false;
    324324    }
     
    326326    pmFPAfile *jpeg2 = pmFPAfileDefineOutput(config, NULL, "PPSUB.OUTPUT.JPEG2");
    327327    if (!jpeg2) {
    328         psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT.JPEG2"));
     328        psError(psErrorCodeLast(), false, _("Unable to generate output file from PPSUB.OUTPUT.JPEG2"));
    329329        return false;
    330330    }
    331331    if (jpeg2->type != PM_FPA_FILE_JPEG) {
    332         psError(PS_ERR_IO, true, "PPSUB.OUTPUT.JPEG2 is not of type JPEG");
     332        psError(psErrorCodeLast(), true, "PPSUB.OUTPUT.JPEG2 is not of type JPEG");
    333333        return false;
    334334    }
     
    338338    pmFPAfile *jpeg3 = pmFPAfileDefineOutput(config, NULL, "PPSUB.OUTPUT.RESID.JPEG");
    339339    if (!jpeg3) {
    340         psError(PS_ERR_IO, false, _("Unable to generate output file from PPSUB.OUTPUT.RESID.JPEG"));
     340        psError(psErrorCodeLast(), false, _("Unable to generate output file from PPSUB.OUTPUT.RESID.JPEG"));
    341341        return false;
    342342    }
    343343    if (jpeg3->type != PM_FPA_FILE_JPEG) {
    344         psError(PS_ERR_IO, true, "PPSUB.OUTPUT.RESID.JPEG is not of type JPEG");
     344        psError(psErrorCodeLast(), true, "PPSUB.OUTPUT.RESID.JPEG is not of type JPEG");
    345345        return false;
    346346    }
     
    360360        pmFPAfile *psphot = pmFPAfileDefineFromFPA(config, output->fpa, 1, 1, "PSPHOT.INPUT");
    361361        if (!psphot) {
    362             psError(PS_ERR_IO, false, "Failed to build FPA from PSPHOT.INPUT");
     362            psError(psErrorCodeLast(), false, "Failed to build FPA from PSPHOT.INPUT");
    363363            return false;
    364364        }
    365365        if (psphot->type != PM_FPA_FILE_IMAGE) {
    366             psError(PS_ERR_IO, true, "PSPHOT.INPUT is not of type IMAGE");
     366            psError(psErrorCodeLast(), true, "PSPHOT.INPUT is not of type IMAGE");
    367367            return false;
    368368        }
     
    374374        pmFPAfile *psf = pmFPAfileDefineFromFPA(config, output->fpa, 1, 1, "PSPHOT.PSF.LOAD");
    375375        if (!psf) {
    376             psError(PS_ERR_IO, false, "Failed to build FPA from PSPHOT.PSF.LOAD");
     376            psError(psErrorCodeLast(), false, "Failed to build FPA from PSPHOT.PSF.LOAD");
    377377            return false;
    378378        }
    379379        if (psf->type != PM_FPA_FILE_PSF) {
    380             psError(PS_ERR_IO, true, "PSPHOT.PSF.LOAD is not of type PSF");
     380            psError(psErrorCodeLast(), true, "PSPHOT.PSF.LOAD is not of type PSF");
    381381            return false;
    382382        }
     
    384384
    385385        if (!psphotDefineFiles(config, psphot)) {
    386             psError(PS_ERR_UNKNOWN, false, "Unable to set up psphot files.");
     386            psError(psErrorCodeLast(), false, "Unable to set up psphot files.");
    387387            return false;
    388388        }
     
    395395                                                 PM_FPA_FILE_CMF);
    396396        if (!outSources) {
    397             psError(PS_ERR_UNKNOWN, false, "Unable to set up output source file.");
     397            psError(psErrorCodeLast(), false, "Unable to set up output source file.");
    398398            return false;
    399399        }
     
    404404                                                     PM_FPA_FILE_CMF);
    405405            if (!invSources) {
    406                 psError(PS_ERR_UNKNOWN, false, "Unable to set up inverse source file.");
     406                psError(psErrorCodeLast(), false, "Unable to set up inverse source file.");
    407407                return false;
    408408            }
Note: See TracChangeset for help on using the changeset viewer.