2018-06-26 16:36:26 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2014-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under both the Apache 2.0 license (found in the
|
|
|
|
* LICENSE file in the root directory of this source tree) and the GPLv2 (found
|
|
|
|
* in the COPYING file in the root directory of this source tree).
|
|
|
|
* You may select, at your option, one of the above-listed licenses.
|
|
|
|
*/
|
|
|
|
|
2018-09-21 18:54:31 +00:00
|
|
|
#include "status.h"
|
2018-06-26 16:36:26 +00:00
|
|
|
|
|
|
|
#include <cassert>
|
|
|
|
|
|
|
|
namespace osquery {
|
|
|
|
|
|
|
|
constexpr int Status::kSuccessCode;
|
|
|
|
|
|
|
|
Status Status::failure(int code, std::string message) {
|
|
|
|
assert(code != Status::kSuccessCode &&
|
|
|
|
"Using 'failure' to create Status object with a kSuccessCode");
|
|
|
|
return Status(code, std::move(message));
|
|
|
|
}
|
|
|
|
|
2018-09-21 18:54:31 +00:00
|
|
|
::std::ostream& operator<<(::std::ostream& os, const Status& s) {
|
|
|
|
return os << "Status(" << s.getCode() << R"(, ")" << s.getMessage()
|
|
|
|
<< R"("))";
|
|
|
|
}
|
|
|
|
|
2018-06-26 16:36:26 +00:00
|
|
|
} // namespace osquery
|