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

@@ -15,14 +15,30 @@
using namespace frc;
void Error::Clone(const Error& error) {
m_code = error.m_code;
m_message = error.m_message;
m_filename = error.m_filename;
m_function = error.m_function;
m_lineNumber = error.m_lineNumber;
m_originatingObject = error.m_originatingObject;
m_timestamp = error.m_timestamp;
Error::Error(Code code, const wpi::Twine& contextMessage,
wpi::StringRef filename, wpi::StringRef function, int lineNumber,
const ErrorBase* originatingObject) {
Set(code, contextMessage, filename, function, lineNumber, originatingObject);
}
bool Error::operator<(const Error& rhs) const {
if (m_code < rhs.m_code) {
return true;
} else if (m_message < rhs.m_message) {
return true;
} else if (m_filename < rhs.m_filename) {
return true;
} else if (m_function < rhs.m_function) {
return true;
} else if (m_lineNumber < rhs.m_lineNumber) {
return true;
} else if (m_originatingObject < rhs.m_originatingObject) {
return true;
} else if (m_timestamp < rhs.m_timestamp) {
return true;
} else {
return false;
}
}
Error::Code Error::GetCode() const { return m_code; }