Changeset 18144


Ignore:
Timestamp:
02/18/15 12:07:29 (10 years ago)
Author:
tbretz
Message:
Accounted for the change in exception handling.
Location:
trunk/Mars/mdrs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mdrs/MDrsCalibration.h

    r17758 r18144  
    3030    }
    3131
    32     bool ReadFits(TString str)
     32    bool ReadFits(const TString &str)
    3333    {
    3434        gSystem->ExpandPathName(str);
    3535
    36         const std::string msg = ReadFitsImp(str.Data());
     36        string msg;
     37        try
     38        {
     39            msg = ReadFitsImp(str.Data());
     40        }
     41        catch (const exception &e)
     42        {
     43            msg = e.what();
     44        }
     45
    3746        if (msg.empty())
     47        {
     48            *fLog << inf << "Read DRS calibration file " << fname << endl;
    3849            return true;
     50        }
    3951
    40         *fLog << err << msg << std::endl;
     52        *fLog << err << "Error reading from " << fname << ": " << msg << endl;
    4153        return false;
    4254    }
  • trunk/Mars/mdrs/MDrsCalibrationTime.cc

    r18123 r18144  
    5151bool MDrsCalibrationTime::ReadFits(const string &fname)
    5252{
    53     const std::string msg = DrsCalibrateTime::ReadFitsImp(fname);
     53    string msg;
     54    try
     55    {
     56        msg = DrsCalibrateTime::ReadFitsImp(fname);
     57    }
     58    catch (const exception &e)
     59    {
     60        msg = e.what();
     61    }
     62
    5463    if (msg.empty())
    5564    {
    56         *fLog << inf << "Wrote DRS calibration file " << fname << endl;
    57         return kTRUE;
     65        *fLog << inf << "Read DRS calibration file " << fname << endl;
     66        return true;
    5867    }
    5968
    60     *fLog << err << "Error writing to " << fname << ": " << msg << endl;
    61     return kFALSE;
     69    *fLog << err << "Error reading from " << fname << ": " << msg << endl;
     70    return false;
    6271}
    6372
     
    6877    {
    6978        *fLog << err << "File '" << fname << "' already exists." << endl;
    70         return kFALSE;
     79        return false;
    7180    }
    7281
    73     const std::string msg = DrsCalibrateTime::WriteFitsImp(fname);
     82    string msg;
     83    try
     84    {
     85        msg = DrsCalibrateTime::WriteFitsImp(fname);
     86    }
     87    catch (const exception &e)
     88    {
     89        msg = e.what();
     90    }
     91
    7492    if (msg.empty())
    7593    {
    7694        *fLog << inf << "Wrote DRS calibration file " << fname << endl;
    77         return kTRUE;
     95        return true;
    7896    }
    7997
    8098    *fLog << err << "Error writing to " << fname << ": " << msg << endl;
    81     return kFALSE;
     99    return false;
    82100}
Note: See TracChangeset for help on using the changeset viewer.