37const char *
kAssertMsg =
"%s violated at line %d of `%s'";
38const char *
kCheckMsg =
"%s not true at line %d of `%s'";
75 fprintf(stderr,
"\n *** Break *** ");
76 fprintf(stderr,
"<%s>: %s\n", location ? location :
"unspecified location", msg);
79 fprintf(stderr,
"aborting\n");
114 fmt =
"no error message provided";
118 thread_local int bufSize =
sizeof(smallBuf);
119 thread_local char *bufDynStorage =
nullptr;
121 char *buf = bufDynStorage ? bufDynStorage : smallBuf;
127 int nWritten = vsnprintf(buf, bufSize, fmt, ap);
132 nAdditional = strlen(sysHandler()) + 1;
134 nAdditional =
snprintf(
nullptr, 0,
" (errno: %d)", errno);
140 int nRequired = nWritten + nAdditional + 1;
141 if (nRequired >= bufSize) {
146 bufSize = std::max(bufSize * 2, nRequired);
147 buf = bufDynStorage =
new char[bufSize];
149 vsnprintf(buf, bufSize, fmt, apCopy);
153 assert(nRequired <= bufSize);
157 [[maybe_unused]]
int nWrittenPost = 0;
158 if (nAdditional > 0) {
161 nWrittenPost =
snprintf(buf + nWritten, bufSize - nWritten,
" %s", sysHandler());
163 nWrittenPost =
snprintf(buf + nWritten, bufSize - nWritten,
" (errno: %d)", errno);
167 assert(nWrittenPost == nAdditional);
168 assert(nWritten + nWrittenPost + 1 <= nRequired);
184 Warning(method,
"this method must be overridden!");
193 Warning(method,
"may not use this method");
200void Obsolete(
const char *function,
const char *asOfVers,
const char *removedFromVers)
202 Warning(function,
"obsolete as of %s and will be removed from %s", asOfVers, removedFromVers);
208void Error(
const char *location,
const char *fmt, ...)
219void SysError(
const char *location,
const char *fmt, ...)
230void Break(
const char *location,
const char *fmt, ...)
241void Info(
const char *location,
const char *fmt, ...)
252void Warning(
const char *location,
const char *fmt, ...)
267void Fatal(
const char *location,
const char *fmt, ...)
int Int_t
Signed integer 4 bytes (int).
bool Bool_t
Boolean (0=false, 1=true) (bool).
void Error(const char *location, const char *fmt,...)
Use this function in case an error occurred.
void Break(const char *location, const char *fmt,...)
Use this function in case an error occurred.
ErrorHandlerFunc_t GetErrorHandler()
Returns the current error handler function.
void Info(const char *location, const char *fmt,...)
Use this function for informational messages.
static ErrorHandlerFunc_t gErrorHandler
void SysError(const char *location, const char *fmt,...)
Use this function in case a system (OS or GUI) related error occurred.
static ROOT::Internal::ErrorSystemMsgHandlerFunc_t & GetErrorSystemMsgHandlerRef()
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 "rea...
void ErrorHandler(Int_t level, const char *location, const char *fmt, std::va_list ap)
General error handler function. It calls the user set error handler.
void Warning(const char *location, const char *fmt,...)
Use this function in warning situations.
void MayNotUse(const char *method)
This function can be used in classes that should override a certain function, but in the inherited cl...
void Fatal(const char *location, const char *fmt,...)
Use this function in case of a fatal error. It will abort the program.
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.
externconst char * kAssertMsg
externconst char * kCheckMsg
void(* ErrorHandlerFunc_t)(int level, Bool_t abort, const char *location, const char *msg)
externInt_t gErrorAbortLevel
non-ignored errors with level equal or above this value will call abort(). Default is kSysError+1.
externBool_t gPrintViaErrorHandler
If true, ROOT's Printf will print via the currently active ROOT error handler; if false (default),...
constexpr Int_t kSysError
externInt_t gErrorIgnoreLevel
errors with level below this value will be ignored. Default is kUnset.
std::function< const char *()> ErrorSystemMsgHandlerFunc_t
Retrieves the error string associated with the last system error.
void MinimalErrorHandler(int level, Bool_t abort, const char *location, const char *msg)
A very simple error handler that is usually replaced by the TROOT default error handler.
ErrorSystemMsgHandlerFunc_t SetErrorSystemMsgHandler(ErrorSystemMsgHandlerFunc_t h)
Returns the previous system error message handler.
ErrorSystemMsgHandlerFunc_t GetErrorSystemMsgHandler()