Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TError.h File Reference
#include <DllImport.h>
#include "RtypesCore.h"
#include <ROOT/RConfig.hxx>
#include <cstdarg>
#include <functional>

Namespaces

namespace  ROOT
namespace  ROOT::Internal

Macros

#define R__ASSERT(e)
 Checks condition e and reports a fatal error if it's false.
#define R__CHECK(e)
 Checks condition e and reports a warning message if it's false.

Typedefs

typedef void(* ErrorHandlerFunc_t) (int level, Bool_t abort, const char *location, const char *msg)
using ROOT::Internal::ErrorSystemMsgHandlerFunc_t = std::function<const char *()>
 Retrieves the error string associated with the last system error.

Functions

void AbstractMethod (const char *method)
 This function can be used in abstract base classes in case one does not want to make the class a "real" (in C++ sense) ABC.
void Break (const char *location, const char *msgfmt,...)
 Use this function in case an error occurred.
void DefaultErrorHandler (int level, Bool_t abort, const char *location, const char *msg)
 The default error handler function.
void Error (const char *location, const char *msgfmt,...)
 Use this function in case an error occurred.
void ErrorHandler (int level, const char *location, const char *fmt, std::va_list va)
 General error handler function. It calls the user set error handler.
void Fatal (const char *location, const char *msgfmt,...)
 Use this function in case of a fatal error. It will abort the program.
ErrorHandlerFunc_t GetErrorHandler ()
 Returns the current error handler function.
ErrorSystemMsgHandlerFunc_t ROOT::Internal::GetErrorSystemMsgHandler ()
void Info (const char *location, const char *msgfmt,...)
 Use this function for informational messages.
void MayNotUse (const char *method)
 This function can be used in classes that should override a certain function, but in the inherited class the function makes no sense.
void ROOT::Internal::MinimalErrorHandler (Int_t level, Bool_t abort_bool, const char *location, const char *msg)
 A very simple error handler that is usually replaced by the TROOT default error handler.
void Obsolete (const char *function, const char *asOfVers, const char *removedFromVers)
 Use this function to declare a function obsolete.
ErrorHandlerFunc_t SetErrorHandler (ErrorHandlerFunc_t newhandler)
 Set an errorhandler function. Returns the old handler.
ErrorSystemMsgHandlerFunc_t ROOT::Internal::SetErrorSystemMsgHandler (ErrorSystemMsgHandlerFunc_t h)
 Returns the previous system error message handler.
void SysError (const char *location, const char *msgfmt,...)
 Use this function in case a system (OS or GUI) related error occurred.
void Warning (const char *location, const char *msgfmt,...)
 Use this function in warning situations.

Variables

externInt_t gErrorAbortLevel
 non-ignored errors with level equal or above this value will call abort(). Default is kSysError+1.
externInt_t gErrorIgnoreLevel
 errors with level below this value will be ignored. Default is kUnset.
externBool_t gPrintViaErrorHandler
 If true, ROOT's Printf will print via the currently active ROOT error handler; if false (default), it will use the standard printf.
externconst char * kAssertMsg
constexpr Int_t kBreak = 4000
externconst char * kCheckMsg
constexpr Int_t kError = 3000
constexpr Int_t kFatal = 6000
constexpr Int_t kInfo = 1000
constexpr Int_t kPrint = 0
constexpr Int_t kSysError = 5000
constexpr Int_t kUnset = -1
constexpr Int_t kWarning = 2000

Macro Definition Documentation

◆ R__ASSERT

#define R__ASSERT ( e)
Value:
do { \
if (R__unlikely(!(e))) \
::Fatal("", kAssertMsg, _QUOTE_(e), __LINE__, __FILE__); \
} while (false)
#define _QUOTE_(name)
Definition RConfig.hxx:446
#define R__unlikely(expr)
Definition RConfig.hxx:586
#define e(i)
Definition RSha256.hxx:103
externconst char * kAssertMsg
Definition TError.h:116

Checks condition e and reports a fatal error if it's false.

Warning
  • this check is NOT stripped in release mode, so it should not be used for hot paths. For those cases, prefer a regular assert();
  • depending on gErrorIgnoreLevel, this might not terminate the program,
See also
Fatal.

Definition at line 125 of file TError.h.

◆ R__CHECK

#define R__CHECK ( e)
Value:
do { \
if (R__unlikely(!(e))) \
::Warning("", kCheckMsg, _QUOTE_(e), __LINE__, __FILE__); \
} while (false)
externconst char * kCheckMsg
Definition TError.h:117

Checks condition e and reports a warning message if it's false.

Warning
this check is NOT stripped in release mode, so it should not be used for hot paths.

Definition at line 134 of file TError.h.

Typedef Documentation

◆ ErrorHandlerFunc_t

typedef void(* ErrorHandlerFunc_t) (int level, Bool_t abort, const char *location, const char *msg)

Definition at line 71 of file TError.h.

Function Documentation

◆ AbstractMethod()

void AbstractMethod ( const char * method)
extern

This function can be used in abstract base classes in case one does not want to make the class a "real" (in C++ sense) ABC.

If this function is called it will warn the user that the function should have been overridden.

Definition at line 182 of file TError.cxx.

◆ Break()

void Break ( const char * location,
const char * msgfmt,
... )
extern

Use this function in case an error occurred.

Definition at line 230 of file TError.cxx.

◆ DefaultErrorHandler()

void DefaultErrorHandler ( Int_t level,
Bool_t abort_bool,
const char * location,
const char * msg )
extern

The default error handler function.

It prints the message on stderr and if abort is set it aborts the application. Replaces the minimal error handler of TError.h as part of the gROOT construction. TError's minimal handler is put back in place during the gROOT destruction.

Note
abort() is only called if abort_bool is true and level >= gErrorIgnoreLevel

Definition at line 102 of file TErrorDefaultHandler.cxx.

◆ Error()

void Error ( const char * location,
const char * msgfmt,
... )
extern

Use this function in case an error occurred.

Definition at line 208 of file TError.cxx.

◆ ErrorHandler()

void ErrorHandler ( int level,
const char * location,
const char * fmt,
std::va_list va )

General error handler function. It calls the user set error handler.

Definition at line 111 of file TError.cxx.

◆ Fatal()

void Fatal ( const char * location,
const char * fmt,
... )
extern

Use this function in case of a fatal error. It will abort the program.

Warning
Fatal() will not abort the program if gErrorIgnoreLevel > kFatal
  • but for all reasonable settings it will abort.

Definition at line 267 of file TError.cxx.

◆ GetErrorHandler()

ErrorHandlerFunc_t GetErrorHandler ( )
extern

Returns the current error handler function.

Definition at line 102 of file TError.cxx.

◆ Info()

void Info ( const char * location,
const char * msgfmt,
... )
extern

Use this function for informational messages.

Definition at line 241 of file TError.cxx.

◆ MayNotUse()

void MayNotUse ( const char * method)
extern

This function can be used in classes that should override a certain function, but in the inherited class the function makes no sense.

Definition at line 191 of file TError.cxx.

◆ Obsolete()

void Obsolete ( const char * function,
const char * asOfVers,
const char * removedFromVers )
extern

Use this function to declare a function obsolete.

Specify as of which version the method is obsolete and as from which version it will be removed.

Definition at line 200 of file TError.cxx.

◆ SetErrorHandler()

ErrorHandlerFunc_t SetErrorHandler ( ErrorHandlerFunc_t newhandler)
extern

Set an errorhandler function. Returns the old handler.

Definition at line 92 of file TError.cxx.

◆ SysError()

void SysError ( const char * location,
const char * msgfmt,
... )
extern

Use this function in case a system (OS or GUI) related error occurred.

Definition at line 219 of file TError.cxx.

◆ Warning()

void Warning ( const char * location,
const char * msgfmt,
... )
extern

Use this function in warning situations.

Definition at line 252 of file TError.cxx.

Variable Documentation

◆ gErrorAbortLevel

externInt_t gErrorAbortLevel

non-ignored errors with level equal or above this value will call abort(). Default is kSysError+1.

Definition at line 141 of file TError.h.

◆ gErrorIgnoreLevel

externInt_t gErrorIgnoreLevel

errors with level below this value will be ignored. Default is kUnset.

Definition at line 140 of file TError.h.

◆ gPrintViaErrorHandler

externBool_t gPrintViaErrorHandler

If true, ROOT's Printf will print via the currently active ROOT error handler; if false (default), it will use the standard printf.

Definition at line 142 of file TError.h.

◆ kAssertMsg

externconst char* kAssertMsg

Definition at line 116 of file TError.h.

◆ kBreak

Int_t kBreak = 4000
constexpr

Definition at line 48 of file TError.h.

◆ kCheckMsg

externconst char* kCheckMsg

Definition at line 117 of file TError.h.

◆ kError

Int_t kError = 3000
constexpr

Definition at line 47 of file TError.h.

◆ kFatal

Int_t kFatal = 6000
constexpr

Definition at line 50 of file TError.h.

◆ kInfo

Int_t kInfo = 1000
constexpr

Definition at line 45 of file TError.h.

◆ kPrint

Int_t kPrint = 0
constexpr

Definition at line 44 of file TError.h.

◆ kSysError

Int_t kSysError = 5000
constexpr

Definition at line 49 of file TError.h.

◆ kUnset

Int_t kUnset = -1
constexpr

Definition at line 43 of file TError.h.

◆ kWarning

Int_t kWarning = 2000
constexpr

Definition at line 46 of file TError.h.