IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 18, 2010, 6:42:01 PM (16 years ago)
Author:
Paul Price
Message:

Reworked ppStack to be better about error codes and their translation to exit codes.

Location:
trunk/ppStack/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src

    • Property svn:ignore
      •  

        old new  
        1010stamp-h1
        1111ppStackVersionDefinitions.h
         12ppStackErrorCodes.c
         13ppStackErrorCodes.h
  • trunk/ppStack/src/ppStackConvolve.c

    r26898 r27004  
    8282        } else if (options->numCols != readout->image->numCols ||
    8383                   options->numRows != readout->image->numRows) {
    84             psError(PS_ERR_UNKNOWN, true, "Sizes of input images don't match: %dx%d vs %dx%d",
     84            psError(PPSTACK_ERR_ARGUMENTS, true, "Sizes of input images don't match: %dx%d vs %dx%d",
    8585                    readout->image->numCols, readout->image->numRows, options->numCols, options->numRows);
    8686            psFree(rng);
     
    9494        options->origCovars->data[i] = psMemIncrRefCounter(readout->covariance);
    9595        if (!ppStackMatch(readout, options, i, config)) {
    96             // XXX many things can cause a failure of ppStackMatch -- should some be handled differently?
    97             psErrorStackPrint(stderr, "Unable to match image %d --- ignoring.", i);
    98             options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] |= PPSTACK_MASK_MATCH;
    99             psErrorClear();
    100             continue;
     96            // XXX many things can cause a failure of ppStackMatch -- should some be handled differently?
     97            psErrorCode error = psErrorCodeLast(); // Error code
     98            switch (error) {
     99                // Fatal errors
     100              case PM_ERR_CONFIG:
     101              case PPSTACK_ERR_CONFIG:
     102              case PPSTACK_ERR_IO:
     103                psError(error, false, "Unable to match image %d due to fatal error.", i);
     104                return false;
     105                // Non-fatal errors
     106              case PM_ERR_STAMPS:
     107              case PM_ERR_SMALL_AREA:
     108              case PPSTACK_ERR_DATA:
     109              default:
     110                psErrorStackPrint(stderr, "Unable to match image %d --- ignoring.", i);
     111                options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] |= PPSTACK_MASK_MATCH;
     112                psErrorClear();
     113                continue;
     114            }
    101115        }
    102116        options->convCovars->data[i] = psMemIncrRefCounter(readout->covariance);
     
    136150        assert(hdu);
    137151        if (!ppStackWriteImage(options->convImages->data[i], hdu->header, readout->image, config)) {
    138             psError(PS_ERR_IO, false, "Unable to write convolved image %d", i);
     152            psError(PPSTACK_ERR_IO, false, "Unable to write convolved image %d", i);
    139153            psFree(fpaList);
    140154            psFree(cellList);
     
    145159        pmConfigMaskWriteHeader(config, maskHeader);
    146160        if (!ppStackWriteImage(options->convMasks->data[i], maskHeader, readout->mask, config)) {
    147             psError(PS_ERR_IO, false, "Unable to write convolved mask %d", i);
     161            psError(PPSTACK_ERR_IO, false, "Unable to write convolved mask %d", i);
    148162            psFree(fpaList);
    149163            psFree(cellList);
     
    154168        psFree(maskHeader);
    155169        if (!ppStackWriteImage(options->convVariances->data[i], hdu->header, readout->variance, config)) {
    156             psError(PS_ERR_IO, false, "Unable to write convolved variance %d", i);
     170            psError(PPSTACK_ERR_IO, false, "Unable to write convolved variance %d", i);
    157171            psFree(fpaList);
    158172            psFree(cellList);
     
    208222
    209223    if (numGood == 0) {
    210         psError(PS_ERR_UNKNOWN, false, "No good images to combine.");
     224        psError(PPSTACK_ERR_REJECTED, false, "No good images to combine.");
    211225        psFree(fpaList);
    212226        psFree(cellList);
     
    257271        assert(values->n == numGood);
    258272        if (!psVectorSortInPlace(values)) {
    259             psError(PS_ERR_UNKNOWN, false, "Unable to sort vector.");
     273            psError(PPSTACK_ERR_PROG, false, "Unable to sort vector.");
    260274            psFree(values);
    261275            return false;
     
    295309
    296310    if (numGood == 0) {
    297         psError(PS_ERR_UNKNOWN, false, "No good images to combine.");
     311        psError(PPSTACK_ERR_REJECTED, false, "No good images to combine.");
    298312        return false;
    299313    }
Note: See TracChangeset for help on using the changeset viewer.