IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10468


Ignore:
Timestamp:
Dec 4, 2006, 5:42:11 PM (20 years ago)
Author:
magnier
Message:

fixed exit states and error messages

File:
1 edited

Legend:

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

    r10460 r10468  
    44 *  @author EAM (IfA)
    55 *
    6  *  @version $Revision: 1.59 $ $Name: not supported by cvs2svn $
    7  *  @date $Date: 2006-12-05 02:31:24 $
     6 *  @version $Revision: 1.60 $ $Name: not supported by cvs2svn $
     7 *  @date $Date: 2006-12-05 03:42:11 $
    88 *
    99 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    476476    psMetadata *rule = psMetadataLookupMetadata(&mdStatus, cameraFormat, "RULE");
    477477    if (! mdStatus || ! rule) {
    478         psError(PS_ERR_UNKNOWN, true, "Unable to read rule for camera.\n");
     478        psError(PS_ERR_UNKNOWN, false, "Unable to read rule for camera.");
    479479        return false;
    480480    }
     
    487487        psMetadataItem *headerItem = psMetadataLookup(header, ruleItem->name);
    488488        if (! headerItem) {
    489             // It doesn't have a required header keyword, so it's not it
     489            // doesn't match, but not an error
     490            psTrace("psModules.config", 5, "Can't find %s", ruleItem->name);
    490491            psFree(ruleIter);
    491             psError(PS_ERR_UNKNOWN, true, "Can't find %s\n", ruleItem->name);
    492492            return false;
    493493        }
     
    495495        // Check to see if the rule works
    496496        if (! psMetadataItemCompare(headerItem, ruleItem)) {
    497             psError(PS_ERR_UNKNOWN, true, "%s doesn't match.\n", ruleItem->name);
     497            psTrace("psModules.config", 5, "%s doesn't match.", ruleItem->name);
    498498            psFree(ruleIter);
    499499            return false;
     
    504504    return true;
    505505}
    506 
    507506
    508507// Given a camera and a header, see if any of the camera formats match the header
     
    524523    psMetadata *formats = psMetadataLookupMetadata(&mdok, camera, "FORMATS"); // List of formats
    525524    if (!mdok || !formats) {
    526         psLogMsg("psModules.config", PS_LOG_WARN, "Unable to find list of FORMATS in camera %s --- ignored\n",
    527                  cameraName);
     525        psError(PS_ERR_UNKNOWN, false, "Unable to find list of FORMATS in camera %s", cameraName);
    528526        return false;
    529527    }
     
    533531    while ((formatsItem = psMetadataGetAndIncrement(formatsIter))) {
    534532        if (formatsItem->type != PS_DATA_STRING) {
    535             psLogMsg("psModules.config", PS_LOG_WARN, "In camera %s, camera format %s is not of type STR --- "
    536                      "ignored.\n", cameraName, formatsItem->name);
    537             continue;
     533            psError(PS_ERR_UNKNOWN, false, "In camera %s, camera format %s is not of type STR", cameraName, formatsItem->name);
     534            return false;
    538535        }
    539536        psTrace("psModules.config", 5, "Reading camera format for %s...\n", formatsItem->name);
    540537        psMetadata *testFormat = NULL;  // Format to test against what we've got
    541538        if (!pmConfigFileRead(&testFormat, formatsItem->data.V, formatsItem->name)) {
    542             psLogMsg("psModules.config", PS_LOG_WARN, "Trouble reading reading camera format %s --- ignored.\n",
    543                      formatsItem->name);
     539            psError(PS_ERR_UNKNOWN, false, "Trouble reading reading camera format %s", formatsItem->name);
    544540            psFree(testFormat);
    545             continue;
     541            return false;
    546542        }
    547543
     
    557553            }
    558554        } else {
    559             if (psTraceGetLevel ("psModules.config") >= PS_LOG_INFO) {
    560                 psErrorStackPrint (stderr, "Camera %s, format %s does not match\n", cameraName, formatsItem->name);
     555            psErr *error = psErrorLast();
     556            if (error->code != PS_ERR_NONE) {
     557                psError (PS_ERR_UNKNOWN, false, "Error in config scripts for camera %s, format %s\n", cameraName, formatsItem->name);
     558                return false;
    561559            }
    562560        }
     
    611609                config->camera = psMemIncrRefCounter(testCamera);
    612610                config->cameraName = psStringCopy(camerasItem->name);
     611            } else {
     612                psErr *error = psErrorLast();
     613                if (error->code != PS_ERR_NONE) {
     614                    psError(PS_ERR_IO, false, "Error reading camera config data for %s", camerasItem->name);
     615                    return NULL;
     616                }
    613617            }
    614618            psFree(testCamera);
     
    623627        // Now we have the camera, we can read the recipes
    624628        pmConfigReadRecipes(config, PM_RECIPE_SOURCE_CAMERA | PM_RECIPE_SOURCE_CL);
    625 
    626629        return format;
    627630    }
Note: See TracChangeset for help on using the changeset viewer.