Ignore:
Timestamp:
11/21/11 01:47:02 (13 years ago)
Author:
neise
Message:
GetN(const string &key) produces now decent error output in case of not found key
File:
1 edited

Legend:

Unmodified
Added
Removed
  • fact/tools/rootmacros/fits.h

    r12467 r12579  
    372372        {
    373373            const Columns::const_iterator it = cols.find(key);
     374            if (it==cols.end()){
     375                ostringstream str;
     376                str << "Key '" << key << "' not found." << endl;
     377                str << "Possible keys are:" << endl;
     378                for ( Columns::const_iterator it=cols.begin() ; it != cols.end(); ++it){
     379                    str << it->first << endl;
     380                }
     381#ifdef __EXCEPTIONS
     382                throw runtime_error(str.str());
     383#else
     384                gLog << ___err___ << "ERROR - " << str.str() << endl;
     385                return 0;
     386#endif
     387            }
    374388            return it==cols.end() ? 0 : it->second.num;
    375389        }
Note: See TracChangeset for help on using the changeset viewer.