12 #include "HAL/cpp/priority_mutex.h"
13 #include "llvm/StringRef.h"
15 #define wpi_setErrnoErrorWithContext(context) \
16 this->SetErrnoError((context), __FILE__, __FUNCTION__, __LINE__)
17 #define wpi_setErrnoError() wpi_setErrnoErrorWithContext("")
18 #define wpi_setImaqErrorWithContext(code, context) \
21 this->SetImaqError((code), (context), __FILE__, __FUNCTION__, __LINE__); \
23 #define wpi_setErrorWithContext(code, context) \
26 this->SetError((code), (context), __FILE__, __FUNCTION__, __LINE__); \
28 #define wpi_setErrorWithContextRange(code, min, max, req, context) \
31 this->SetErrorRange((code), (min), (max), (req), (context), __FILE__, \
32 __FUNCTION__, __LINE__); \
34 #define wpi_setError(code) wpi_setErrorWithContext(code, "")
35 #define wpi_setStaticErrorWithContext(object, code, context) \
38 object->SetError((code), (context), __FILE__, __FUNCTION__, __LINE__); \
40 #define wpi_setStaticError(object, code) \
41 wpi_setStaticErrorWithContext(object, code, "")
42 #define wpi_setGlobalErrorWithContext(code, context) \
45 ::frc::ErrorBase::SetGlobalError((code), (context), __FILE__, \
46 __FUNCTION__, __LINE__); \
48 #define wpi_setGlobalError(code) wpi_setGlobalErrorWithContext(code, "")
49 #define wpi_setWPIErrorWithContext(error, context) \
50 this->SetWPIError((wpi_error_s_##error), (wpi_error_value_##error), \
51 (context), __FILE__, __FUNCTION__, __LINE__)
52 #define wpi_setWPIError(error) (wpi_setWPIErrorWithContext(error, ""))
53 #define wpi_setStaticWPIErrorWithContext(object, error, context) \
54 object->SetWPIError((wpi_error_s_##error), (context), __FILE__, \
55 __FUNCTION__, __LINE__)
56 #define wpi_setStaticWPIError(object, error) \
57 wpi_setStaticWPIErrorWithContext(object, error, "")
58 #define wpi_setGlobalWPIErrorWithContext(error, context) \
59 ::frc::ErrorBase::SetGlobalWPIError((wpi_error_s_##error), (context), \
60 __FILE__, __FUNCTION__, __LINE__)
61 #define wpi_setGlobalWPIError(error) wpi_setGlobalWPIErrorWithContext(error, "")
84 llvm::StringRef filename, llvm::StringRef
function,
85 int lineNumber)
const;
86 virtual void SetImaqError(
int success, llvm::StringRef contextMessage,
87 llvm::StringRef filename, llvm::StringRef
function,
88 int lineNumber)
const;
89 virtual void SetError(Error::Code code, llvm::StringRef contextMessage,
90 llvm::StringRef filename, llvm::StringRef
function,
91 int lineNumber)
const;
92 virtual void SetErrorRange(Error::Code code, int32_t minRange,
93 int32_t maxRange, int32_t requestedValue,
94 llvm::StringRef contextMessage,
95 llvm::StringRef filename, llvm::StringRef
function,
96 int lineNumber)
const;
97 virtual void SetWPIError(llvm::StringRef errorMessage, Error::Code code,
98 llvm::StringRef contextMessage,
99 llvm::StringRef filename, llvm::StringRef
function,
100 int lineNumber)
const;
101 virtual void CloneError(
const ErrorBase& rhs)
const;
104 static void SetGlobalError(Error::Code code, llvm::StringRef contextMessage,
105 llvm::StringRef filename, llvm::StringRef
function,
107 static void SetGlobalWPIError(llvm::StringRef errorMessage,
108 llvm::StringRef contextMessage,
109 llvm::StringRef filename,
110 llvm::StringRef
function,
int lineNumber);
114 mutable Error m_error;
117 static Error _globalError;
virtual bool StatusIsFatal() const
Check if the current error code represents a fatal error.
Definition: ErrorBase.cpp:197
virtual void SetErrorRange(Error::Code code, int32_t minRange, int32_t maxRange, int32_t requestedValue, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, int lineNumber) const
Set the current error information associated with this sensor.
Definition: ErrorBase.cpp:138
virtual void SetError(Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, int lineNumber) const
Set the current error information associated with this sensor.
Definition: ErrorBase.cpp:109
virtual Error & GetError()
Retrieve the current error.
Definition: ErrorBase.cpp:28
Base class for most objects.
Definition: ErrorBase.h:72
virtual void ClearError() const
Clear the current error information associated with this sensor.
Definition: ErrorBase.cpp:35
Definition: priority_mutex.h:57
virtual void SetWPIError(llvm::StringRef errorMessage, Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, int lineNumber) const
Set the current error information associated with this sensor.
Definition: ErrorBase.cpp:172
virtual void SetErrnoError(llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, int lineNumber) const
Set error information associated with a C library call that set an error to the "errno" global variab...
Definition: ErrorBase.cpp:46
virtual void SetImaqError(int success, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, int lineNumber) const
Set the current error information associated from the nivision Imaq API.
Definition: ErrorBase.cpp:81
Error object represents a library error.
Definition: Error.h:31
static Error & GetGlobalError()
Retrieve the current global error.
Definition: ErrorBase.cpp:228