Re: [ROOT] ROOT Error handling

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Thu Jan 17 2002 - 14:37:10 MET


Hi Joe,

joe robe wrote:

>>Currently we don't throw anything and there is also
>>no global
>>error variable.
>>
> 
> Is there a reason not to do so ?? It would be simple
> to make a bool fError data member in TObject !
> 


we cannot add data members to TObject (which overhead would
be carried by the zillion of TOBject derived classes).
Exceptions we want to introduce in the future when this
mechanism works solidly on all supported environemnts
(not the case today).


>  The TFile can be catched with the
> 
>>IsZombie()
>>
> 
> It CANT, if you open a NON root file , the file WILL
> be opened. But than when you try to read keys it
> CRASHES. Of course I can read the header and check if
> it is a root file, but thats a lot of work for
> something root already does for me by showing the
> error message. Is there any flag I did not find
> telling me that this IS or IS NOT a root file ?
> 

For me this works:

root [0] TFile f("math.cxx")
Error in <TFile::TFile>: math.cxx not a ROOT file
root [1] f.IsZombie()
(const unsigned char)1


Cheers, Fons.


> 


-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:38 MET