Turning Warnings into Errors

Hello,

if there is a ROOT warning like this one:

Warning in <ROOT::Math::ROOT::Math::GausIntegrator>: Failed to reach the desired tolerance ; maxtol = 0.0001

  1. is there a way how to turn it into a ROOT error (exception) to obtain traceback?

  2. is there a possibility how to do it for all warnings or just some (coming from specified classes)?

  3. is there a way how to ignore certain warnings?

Cheers,
Jiri


Please read tips for efficient and successful posting and posting code

ROOT Version: master
Platform: Not Provided
Compiler: Not Provided


Hi,

You can turn these messages in Fatal messages that will abort ROOT and give you a traceback.
For doing this you just need to do before calling the integrator (making sure there are no others warning messages)
gErrorAbortLevel = kWarning;

Lorenzo

Hello,

many thanks for the suggestion. It works for c++ but not for python at the moment due to this bug https://sft.its.cern.ch/jira/browse/ROOT-10566 . The proposed solution is surely usable in some cases but in some cases it is too cumbersome.

Is there any way how to have more control over warnings and errors originating from a given ROOT class? Does (new) PyROOT provide (or plan to provide) more control over the warning and error messages (see my previous questions)?

Cheers,
Jiri

To do that you can inject your own ErrorHandling/Printing routine.
An example of handler can be found at: https://root.cern/doc/master/TError_8cxx.html#a36b79f85822909423ea1161588335cb5

And you can inject your own with:

SetErrorHandler( newhandler);

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.