Re: [ROOT] ROOT Error handling

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


Currently we don't throw anything and there is also no global
error variable. The TFile can be catched with the IsZombie()
method. For most other methods there is a return code.
IsZombie() typically used in ctor's that cannot return an
error code.

-- Fons


joe robe wrote:

> Thanks but how can my code CHECK if an error occured ?
> Is there a global error variable ?? Or does root throw
> Exeptions and I can use try catch ??
> 
> So I either want
> 
> TFile File("Somefeile");
> If(gError)
> printf("an error occured");
> 
> or
> 
> try
> {
> TFile File("Somefeile");
> }
> catch
> {
> printf("an error occured");
> }
> 
> Joe
> 
> 
>>You can disable the ROOT error messages by setting
>>the global gErrorIgnoreLevel to > then the level you
>>want to disable (see Terror.h). TO disable all
>>messages
>>set gErrorIgenoreLevel = 5000;
>>
>>Cheers, Fons.
>>
>>
>>
>>joe robe wrote:
>>
>>
>>>Hi,
>>>
>>>I cant find any documentaion on ROOT error
>>>
>>handling.
>>
>>>Is there any way to CHECK for errors and avoid
>>>printing them in the console window (for a QT
>>>
>>based
>>
>>>project) ?
>>>
>>>I.e. if I open an NON ROOT file with TFile an
>>>
>>error is
>>
>>>printed, but how can I CHECK for this and do
>>>
>>something
>>
>>>like
>>>
>>>TFile File("smoehting.txt"):
>>>if(File.Error())
>>>printf("file is not a root file");
>>>
>>>Joe
>>>
>>>__________________________________________________
>>>Do You Yahoo!?
>>>Send FREE video emails in Yahoo! Mail!
>>>http://promo.yahoo.com/videomail/
>>>
>>>
>>>
>>
>>-- 
>>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
>>
>>
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Send FREE video emails in Yahoo! Mail!
> http://promo.yahoo.com/videomail/
> 
> 


-- 
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