13 #include "HAL/cpp/priority_mutex.h"
14 #include "llvm/StringRef.h"
16 #define wpi_setErrnoErrorWithContext(context) \
17 this->SetErrnoError((context), __FILE__, __FUNCTION__, __LINE__)
18 #define wpi_setErrnoError() wpi_setErrnoErrorWithContext("")
19 #define wpi_setImaqErrorWithContext(code, context) \
22 this->SetImaqError((code), (context), __FILE__, __FUNCTION__, __LINE__); \
24 #define wpi_setErrorWithContext(code, context) \
27 this->SetError((code), (context), __FILE__, __FUNCTION__, __LINE__); \
29 #define wpi_setError(code) wpi_setErrorWithContext(code, "")
30 #define wpi_setStaticErrorWithContext(object, code, context) \
33 object->SetError((code), (context), __FILE__, __FUNCTION__, __LINE__); \
35 #define wpi_setStaticError(object, code) \
36 wpi_setStaticErrorWithContext(object, code, "")
37 #define wpi_setGlobalErrorWithContext(code, context) \
40 ErrorBase::SetGlobalError((code), (context), __FILE__, __FUNCTION__, \
43 #define wpi_setGlobalError(code) wpi_setGlobalErrorWithContext(code, "")
44 #define wpi_setWPIErrorWithContext(error, context) \
45 this->SetWPIError((wpi_error_s_##error), (wpi_error_value_##error), \
46 (context), __FILE__, __FUNCTION__, __LINE__)
47 #define wpi_setWPIError(error) (wpi_setWPIErrorWithContext(error, ""))
48 #define wpi_setStaticWPIErrorWithContext(object, error, context) \
49 object->SetWPIError((wpi_error_s_##error), (context), __FILE__, \
50 __FUNCTION__, __LINE__)
51 #define wpi_setStaticWPIError(object, error) \
52 wpi_setStaticWPIErrorWithContext(object, error, "")
53 #define wpi_setGlobalWPIErrorWithContext(error, context) \
54 ErrorBase::SetGlobalWPIError((wpi_error_s_##error), (context), __FILE__, \
55 __FUNCTION__, __LINE__)
56 #define wpi_setGlobalWPIError(error) \
57 wpi_setGlobalWPIErrorWithContext(error, "")
79 uint32_t lineNumber)
const;
82 uint32_t lineNumber)
const;
85 uint32_t lineNumber)
const;
89 uint32_t lineNumber)
const;
90 virtual void CloneError(
const ErrorBase& rhs)
const;
93 static void SetGlobalError(Error::Code code,
llvm::StringRef contextMessage,
103 mutable Error m_error;
106 static Error _globalError;
Error object represents a library error.
Definition: Error.h:28
virtual void SetError(Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const
Set the current error information associated with this sensor.
Definition: ErrorBase.cpp:106
virtual void ClearError() const
Clear the current error information associated with this sensor.
Definition: ErrorBase.cpp:31
virtual void SetWPIError(llvm::StringRef errorMessage, Error::Code code, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const
Set the current error information associated with this sensor.
Definition: ErrorBase.cpp:131
virtual bool StatusIsFatal() const
Check if the current error code represents a fatal error.
Definition: ErrorBase.cpp:156
Base class for most objects.
Definition: ErrorBase.h:66
Definition: priority_mutex.h:53
virtual Error & GetError()
Retrieve the current error.
Definition: ErrorBase.cpp:24
virtual void SetErrnoError(llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const
Set error information associated with a C library call that set an error to the "errno" global variab...
Definition: ErrorBase.cpp:42
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:39
virtual void SetImaqError(int success, llvm::StringRef contextMessage, llvm::StringRef filename, llvm::StringRef function, uint32_t lineNumber) const
Set the current error information associated from the nivision Imaq API.
Definition: ErrorBase.cpp:78
static Error & GetGlobalError()
Retrieve the current global error.
Definition: ErrorBase.cpp:188