IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27107


Ignore:
Timestamp:
Feb 26, 2010, 3:04:19 PM (16 years ago)
Author:
Paul Price
Message:

Was writing the images after dumping the configuration, which meant that images weren't listed in the configuration.

Location:
trunk/ppStack/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppStack/src/ppStack.c

    r27076 r27107  
    5858    // Common code for the death.
    5959    {
    60         psExit exitValue = PS_EXIT_SUCCESS;        // Exit value for program
    61         psErrorCode errorCode = psErrorCodeLast(); // Error code
    62         if (errorCode != PS_ERR_NONE) {
    63             psErrorStackPrint(stderr, "Unable to perform stack.");
    64             switch (errorCode) {
    65               case PPSTACK_ERR_UNKNOWN:
    66               case PS_ERR_UNKNOWN:
    67                 exitValue = PS_EXIT_UNKNOWN_ERROR;
    68                 break;
    69               case PS_ERR_IO:
    70               case PS_ERR_DB_CLIENT:
    71               case PS_ERR_DB_SERVER:
    72               case PS_ERR_BAD_FITS:
    73               case PS_ERR_OS_CALL_FAILED:
    74               case PPSTACK_ERR_IO:
    75                 exitValue = PS_EXIT_SYS_ERROR;
    76                 break;
    77               case PS_ERR_BAD_PARAMETER_VALUE:
    78               case PS_ERR_BAD_PARAMETER_TYPE:
    79               case PS_ERR_BAD_PARAMETER_NULL:
    80               case PS_ERR_BAD_PARAMETER_SIZE:
    81               case PPSTACK_ERR_ARGUMENTS:
    82               case PPSTACK_ERR_CONFIG:
    83                 exitValue = PS_EXIT_CONFIG_ERROR;
    84                 break;
    85               case PPSTACK_ERR_PSF:
    86               case PPSTACK_ERR_REJECTED:
    87               case PPSTACK_ERR_DATA:
    88                 exitValue = PS_EXIT_DATA_ERROR;
    89                 break;
    90               case PS_ERR_UNEXPECTED_NULL:
    91               case PS_ERR_PROGRAMMING:
    92               case PPSTACK_ERR_NOT_IMPLEMENTED:
    93               case PPSTACK_ERR_PROG:
    94               default:
    95                 // It's a programming error if we're not dealing with the error correctly
    96                 exitValue = PS_EXIT_PROG_ERROR;
    97                 break;
    98             }
    99         }
     60        psExit exitValue = ppStackExitCode(); // Exit code
    10061
    10162        // Ensure everything closes
     
    10768            if (!ppStackFilesIterateUp(config)) {
    10869                psErrorStackPrint(stderr, "Unable to close files.");
     70                if (exitValue == PS_EXIT_SUCCESS) {
     71                    exitValue = ppStackExitCode();
     72                }
     73            }
     74        }
     75
     76        // Dump configuration
     77        bool mdok;                                                                    // Status of MD lookup
     78        psString dump = psMetadataLookupStr(&mdok, config->arguments, "DUMP_CONFIG"); // File for config
     79        if (dump && !pmConfigDump(config, dump)) {
     80            psErrorStackPrint(stderr, "Unable to dump configuration.");
     81            if (exitValue == PS_EXIT_SUCCESS) {
     82                exitValue = ppStackExitCode();
    10983            }
    11084        }
  • trunk/ppStack/src/ppStack.h

    r27075 r27107  
    169169    );
    170170
     171/// Return an appropriate exit code based on the error code
     172psExit ppStackExitCode(void);
    171173
    172174#endif
  • trunk/ppStack/src/ppStackFinish.c

    r27093 r27107  
    9090    }
    9191
    92     // Dump configuration
    93     psString dump = psMetadataLookupStr(&mdok, config->arguments, "DUMP_CONFIG"); // File for config
    94     if (dump) {
    95         if (!pmConfigDump(config, dump)) {
    96             psError(psErrorCodeLast(), false, "Unable to dump configuration.");
    97             return false;
     92    return true;
     93}
     94
     95
     96psExit ppStackExitCode(void)
     97{
     98    psExit exitValue = PS_EXIT_SUCCESS;        // Exit code to return
     99    psErrorCode errorCode = psErrorCodeLast(); // Error code
     100    if (errorCode != PS_ERR_NONE) {
     101        psErrorStackPrint(stderr, "Unable to perform stack.");
     102        switch (errorCode) {
     103          case PPSTACK_ERR_UNKNOWN:
     104          case PS_ERR_UNKNOWN:
     105            exitValue = PS_EXIT_UNKNOWN_ERROR;
     106            break;
     107          case PS_ERR_IO:
     108          case PS_ERR_DB_CLIENT:
     109          case PS_ERR_DB_SERVER:
     110          case PS_ERR_BAD_FITS:
     111          case PS_ERR_OS_CALL_FAILED:
     112          case PPSTACK_ERR_IO:
     113            exitValue = PS_EXIT_SYS_ERROR;
     114            break;
     115          case PS_ERR_BAD_PARAMETER_VALUE:
     116          case PS_ERR_BAD_PARAMETER_TYPE:
     117          case PS_ERR_BAD_PARAMETER_NULL:
     118          case PS_ERR_BAD_PARAMETER_SIZE:
     119          case PPSTACK_ERR_ARGUMENTS:
     120          case PPSTACK_ERR_CONFIG:
     121            exitValue = PS_EXIT_CONFIG_ERROR;
     122            break;
     123          case PPSTACK_ERR_PSF:
     124          case PPSTACK_ERR_REJECTED:
     125          case PPSTACK_ERR_DATA:
     126            exitValue = PS_EXIT_DATA_ERROR;
     127            break;
     128          case PS_ERR_UNEXPECTED_NULL:
     129          case PS_ERR_PROGRAMMING:
     130          case PPSTACK_ERR_NOT_IMPLEMENTED:
     131          case PPSTACK_ERR_PROG:
     132          default:
     133            // It's a programming error if we're not dealing with the error correctly
     134            exitValue = PS_EXIT_PROG_ERROR;
     135            break;
    98136        }
    99137    }
    100 
    101     return true;
     138    return exitValue;
    102139}
Note: See TracChangeset for help on using the changeset viewer.