IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17524


Ignore:
Timestamp:
May 4, 2008, 2:22:07 PM (18 years ago)
Author:
eugene
Message:

handle real error in pmConfigFileSetsMD (added an abort)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/config/pmConfig.c

    r17510 r17524  
    13191319}
    13201320
     1321// XXX this is a prime example of the failing of our error-handling system.  this function has
     1322// three possible outcomes: the argument was found, it was not found, or we raised an error.
     1323// returning only the bool does not distinguish failure to find the argument from a deeper
     1324// error.  requiring the calling function to both test the bool AND trap the error stack is
     1325// fragile: the error stack may not have been cleared, or they may not do both.  in some
     1326// places, we solve this by returning two types of boolean status values.  a better option
     1327// might be to return a psErrorCode value (as RHL proposed), which would be 0 on success and
     1328// any of several options on failure.
     1329
    13211330bool pmConfigFileSetsMD(psMetadata *metadata, int *argc, char **argv, const char *name,
    13221331                        const char *file, const char *list)
     
    13281337    // if files->n == 0 we'll want to call psError(..., false, ...)
    13291338    psArray *files = pmConfigFileSets(argc, argv, file, list);
     1339    if (!files) {
     1340        psAbort("error parsing argument list");
     1341        psError(PS_ERR_IO, false, "error parsing argument list");
     1342        psFree (files);
     1343        return false;
     1344    }
     1345
     1346    // no files found: this is not really an error
    13301347    if (files->n == 0) {
    1331         // psError(PS_ERR_IO, false, "pmConfigFileSets failed to find %s in the argument list", name);
    13321348        psFree (files);
    13331349        return false;
Note: See TracChangeset for help on using the changeset viewer.