File indexing completed on 2025-12-15 10:29:36
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TError
0013 #define ROOT_TError
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033 #include <DllImport.h> // for R__EXTERN
0034 #include "RtypesCore.h"
0035 #include <ROOT/RConfig.hxx>
0036
0037 #include <cstdarg>
0038 #include <functional>
0039
0040
0041 class TVirtualMutex;
0042
0043 constexpr Int_t kUnset = -1;
0044 constexpr Int_t kPrint = 0;
0045 constexpr Int_t kInfo = 1000;
0046 constexpr Int_t kWarning = 2000;
0047 constexpr Int_t kError = 3000;
0048 constexpr Int_t kBreak = 4000;
0049 constexpr Int_t kSysError = 5000;
0050 constexpr Int_t kFatal = 6000;
0051
0052
0053
0054
0055
0056 namespace ROOT {
0057 namespace Internal {
0058
0059
0060 using ErrorSystemMsgHandlerFunc_t = std::function<const char *()>;
0061
0062 ErrorSystemMsgHandlerFunc_t GetErrorSystemMsgHandler();
0063
0064 ErrorSystemMsgHandlerFunc_t SetErrorSystemMsgHandler(ErrorSystemMsgHandlerFunc_t h);
0065
0066 void MinimalErrorHandler(int level, Bool_t abort, const char *location, const char *msg);
0067
0068 }
0069 }
0070
0071 typedef void (*ErrorHandlerFunc_t)(int level, Bool_t abort, const char *location,
0072 const char *msg);
0073
0074 extern "C" void ErrorHandler(int level, const char *location, const char *fmt, std::va_list va);
0075
0076 extern void DefaultErrorHandler(int level, Bool_t abort, const char *location, const char *msg);
0077
0078 extern ErrorHandlerFunc_t SetErrorHandler(ErrorHandlerFunc_t newhandler);
0079 extern ErrorHandlerFunc_t GetErrorHandler();
0080
0081 extern void Info(const char *location, const char *msgfmt, ...)
0082 #if defined(__GNUC__)
0083 __attribute__((format(printf, 2, 3)))
0084 #endif
0085 ;
0086 extern void Warning(const char *location, const char *msgfmt, ...)
0087 #if defined(__GNUC__)
0088 __attribute__((format(printf, 2, 3)))
0089 #endif
0090 ;
0091 extern void Error(const char *location, const char *msgfmt, ...)
0092 #if defined(__GNUC__)
0093 __attribute__((format(printf, 2, 3)))
0094 #endif
0095 ;
0096 extern void Break(const char *location, const char *msgfmt, ...)
0097 #if defined(__GNUC__)
0098 __attribute__((format(printf, 2, 3)))
0099 #endif
0100 ;
0101 extern void SysError(const char *location, const char *msgfmt, ...)
0102 #if defined(__GNUC__)
0103 __attribute__((format(printf, 2, 3)))
0104 #endif
0105 ;
0106 extern void Fatal(const char *location, const char *msgfmt, ...)
0107 #if defined(__GNUC__)
0108 __attribute__((format(printf, 2, 3)))
0109 #endif
0110 ;
0111
0112 extern void AbstractMethod(const char *method);
0113 extern void MayNotUse(const char *method);
0114 extern void Obsolete(const char *function, const char *asOfVers, const char *removedFromVers);
0115
0116 R__EXTERN const char *kAssertMsg;
0117 R__EXTERN const char *kCheckMsg;
0118
0119
0120
0121
0122
0123
0124
0125 #define R__ASSERT(e) \
0126 do { \
0127 if (R__unlikely(!(e))) \
0128 ::Fatal("", kAssertMsg, _QUOTE_(e), __LINE__, __FILE__); \
0129 } while (false)
0130
0131
0132
0133
0134 #define R__CHECK(e) \
0135 do { \
0136 if (R__unlikely(!(e))) \
0137 ::Warning("", kCheckMsg, _QUOTE_(e), __LINE__, __FILE__); \
0138 } while (false)
0139
0140 R__EXTERN Int_t gErrorIgnoreLevel;
0141 R__EXTERN Int_t gErrorAbortLevel;
0142 R__EXTERN Bool_t gPrintViaErrorHandler;
0143
0144 #endif