Changeset 10995 for trunk/FACT++


Ignore:
Timestamp:
06/10/11 20:47:35 (13 years ago)
Author:
tbretz
Message:
Added some example code to handle FITS errors.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/EventBuilderWrapper.h

    r10979 r10995  
    502502        int status = 0;
    503503        fits_write_tblbytes(fFile->fitsPointer(), fNumRows, start, size, reinterpret_cast<unsigned char*>(e), &status);
     504        if (status)
     505        {
     506            char text[30];//max length of cfitsio error strings (from doc)
     507            fits_get_errstatus(status, text);
     508            //ostringstream str;
     509            //str << "Writing FITS row " << i << " in " << groupName << ": " << text << " (file_write_tblbytes, rc=" << status << ")";
     510            //Error(str);
     511        }
     512
    504513        start += size;
    505514        return status;
     
    520529        if (fits_insert_rows(fTable->fitsPointer(), fNumRows, 1, &status))
    521530        {
    522             ostringstream str;
    523             str << "Could not insert a row in fits file";
     531            //ostringstream str;
     532            //str << "Inserting row into " << fFileName << " failed (fits_insert_rows, rc=" << status << ")";
     533            //fMess->Error(str);
    524534            //TODO pipe this error message to the appropriate error stream
    525535        }
     
    969979    void factStat(int severity, int err, char* message )
    970980    {
     981        if (err!=-1)
     982        {
     983            factOut(severity, err, message);
     984            return;
     985        }
     986
    971987        static string last;
    972988        if (message==last)
    973989            return;
    974990
    975         if (err!=-1)
    976             factOut(severity, err, message);
    977         else
    978         {
    979             ostringstream str("Status: ");
    980             str << message;
    981             EventBuilderWrapper::This->Update(str, severity);
    982         }
    983 
    984991        last = message;
     992
     993        ostringstream str("Status: ");
     994        str << message;
     995
     996        EventBuilderWrapper::This->Update(str, severity);
    985997    }
    986998
Note: See TracChangeset for help on using the changeset viewer.