Replace globalError in ErrorBase with a global set of all errors (#615)

This commit is contained in:
Tyler Veness
2018-06-18 00:13:28 -07:00
committed by Peter Johnson
parent 2faba39b58
commit 212f378d08
4 changed files with 52 additions and 51 deletions

View File

@@ -34,11 +34,12 @@ class Error {
typedef int Code;
Error() = default;
Error(Code code, const wpi::Twine& contextMessage, wpi::StringRef filename,
wpi::StringRef function, int lineNumber,
const ErrorBase* originatingObject);
Error(const Error&) = delete;
Error& operator=(const Error&) = delete;
bool operator<(const Error& rhs) const;
void Clone(const Error& error);
Code GetCode() const;
std::string GetMessage() const;
std::string GetFilename() const;

View File

@@ -193,14 +193,10 @@ class ErrorBase {
/**
* Retrieve the current global error.
*/
static Error& GetGlobalError();
static const Error& GetGlobalError();
protected:
mutable Error m_error;
// TODO: Replace globalError with a global list of all errors.
static wpi::mutex _globalErrorMutex;
static Error _globalError;
};
} // namespace frc