IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 25, 2010, 4:26:50 PM (16 years ago)
Author:
Paul Price
Message:

Reworking error codes to get consistent exit codes.

File:
1 edited

Legend:

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

    r26896 r27096  
    3131    }
    3232    if (!status) {
    33         psError(PSWARP_ERR_CONFIG, false, "Failed to load file definition for %s", filerule);
     33        psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule);
    3434        return false;
    3535    }
     
    3838        file = pmFPAfileDefineFromRun(&status, bind, config, filerule); // File to return
    3939        if (!status) {
    40             psError(PSWARP_ERR_CONFIG, false, "Failed to load file definition for %s", filerule);
     40            psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule);
    4141            return NULL;
    4242        }
     
    6565    pmFPAfile *input = defineInputFile(config, NULL, "PSWARP.INPUT", "INPUT", PM_FPA_FILE_IMAGE);
    6666    if (!input) {
    67         psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.INPUT");
     67        psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.INPUT");
    6868        return false;
    6969    }
     
    8989    bool status = pswarpDefineSkycell(&skycell, &skyConfig, config, "PSWARP.SKYCELL", "SKYCELL");
    9090    if (!status) {
    91         psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.SKYCELL");
     91        psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.SKYCELL");
    9292        return false;
    9393    }
     
    9797    pmFPAfile *output = pmFPAfileDefineSkycell(config, NULL, "PSWARP.OUTPUT");
    9898    if (!output) {
    99         psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT");
     99        psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT");
    100100        return false;
    101101    }
     
    104104    pmFPAfile *outMask = pmFPAfileDefineSkycell(config, output->fpa, "PSWARP.OUTPUT.MASK");
    105105    if (!outMask) {
    106         psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT.MASK");
     106        psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT.MASK");
    107107        return false;
    108108    }
     
    112112        pmFPAfile *outVariance = pmFPAfileDefineSkycell(config, output->fpa, "PSWARP.OUTPUT.VARIANCE");
    113113        if (!outVariance) {
    114             psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT.VARIANCE");
     114            psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT.VARIANCE");
    115115            return false;
    116116        }
     
    121121        pmFPAfile *outSources = pmFPAfileDefineSkycell(config, output->fpa, "PSWARP.OUTPUT.SOURCES");
    122122        if (!outSources) {
    123             psError(PSWARP_ERR_CONFIG, false, "Failed to build FPA from PSWARP.OUTPUT.SOURCES");
     123            psError(psErrorCodeLast(), false, "Failed to build FPA from PSWARP.OUTPUT.SOURCES");
    124124            return false;
    125125        }
     
    129129    psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, PSWARP_RECIPE);
    130130    if (!recipe) {
    131         psError(PSPHOT_ERR_CONFIG, false, "missing recipe %s", PSWARP_RECIPE);
     131        psError(PSWARP_ERR_CONFIG, false, "missing recipe %s", PSWARP_RECIPE);
    132132        return false;
    133133    }
     
    139139        pmFPAfile *psphotInput = pmFPAfileDefineSkycell(config, NULL, "PSPHOT.INPUT");
    140140        if (!psphotInput) {
    141             psError(PS_ERR_IO, false, _("Unable to generate output file from PSPHOT.INPUT"));
     141            psError(psErrorCodeLast(), false, _("Unable to generate output file from PSPHOT.INPUT"));
    142142            return false;
    143143        }
    144144        psphotInput->src = psMemIncrRefCounter(output->fpa);
    145         // specify the number of psphot input images
    146         psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1);
     145        // specify the number of psphot input images
     146        psMetadataAddS32 (config->arguments, PS_LIST_TAIL, "PSPHOT.INPUT.NUM", PS_META_REPLACE, "number of inputs", 1);
    147147
    148148        pmFPAfile *psphotInSources = pmFPAfileDefineSkycell(config, output->fpa, "PSPHOT.INPUT.CMF");
    149149        if (!psphotInSources) {
    150             psError(PS_ERR_IO, false, _("Unable to generate output file from PSPHOT.INPUT.CMF"));
     150            psError(psErrorCodeLast(), false, _("Unable to generate output file from PSPHOT.INPUT.CMF"));
    151151            return false;
    152152        }
     
    155155        psMetadata *psphotRecipe = psMetadataLookupPtr(NULL, config->recipes, PSPHOT_RECIPE); // Recipe
    156156        if (!psphotRecipe) {
    157             psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find %s recipe.", PSPHOT_RECIPE);
     157            psError(PSWARP_ERR_CONFIG, false, "Unable to find %s recipe.", PSPHOT_RECIPE);
    158158            return false;
    159159        }
     
    162162        // Define associated psphot input/output files
    163163        if (!psphotDefineFiles(config, psphotInput)) {
    164             psError(PSPHOT_ERR_CONFIG, false,
     164            psError(PSWARP_ERR_CONFIG, false,
    165165                    "Unable to define the additional input/output files for psphot");
    166166            return false;
     
    183183                int chipNum = atoi(chips->data[i]);
    184184                if (! pmFPASelectChip(input->fpa, chipNum, false)) {
    185                     psError(PSWARP_ERR_CONFIG, true, "Chip number %d doesn't exist in camera.\n", chipNum);
     185                    psError(PSWARP_ERR_ARGUMENTS, true, "Chip number %d doesn't exist in camera.\n", chipNum);
    186186                    return false;
    187187                }
Note: See TracChangeset for help on using the changeset viewer.