platform2: Move Error class from Buffet to libchromeos
Moved buffet::Error class and related facilities to
libchromeos and changed the namespace to 'chromeos::'.
Updated a bunch of code to include the header files
from the new location and referring to the new
namespace.
BUG=chromium:403604
TEST=USE=buffet ./build_packages
FEATURES=test emerge-link libchromeos
USE=buffet FEATURES=test emerge-link platform2
Change-Id: I0b5b37ccd7ee3b7be9467ebfae5d172d9b057cf6
Reviewed-on: https://chromium-review.googlesource.com/212525
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/http_request.cc b/buffet/http_request.cc
index c08e797..a9fa439 100644
--- a/buffet/http_request.cc
+++ b/buffet/http_request.cc
@@ -127,7 +127,7 @@
ranges_.emplace_back(from_byte, to_byte);
}
-std::unique_ptr<Response> Request::GetResponse(ErrorPtr* error) {
+std::unique_ptr<Response> Request::GetResponse(chromeos::ErrorPtr* error) {
if (!SendRequestIfNeeded(error) || !connection_->FinishRequest(error))
return std::unique_ptr<Response>();
std::unique_ptr<Response> response(new Response(std::move(connection_)));
@@ -159,7 +159,9 @@
headers_.insert(headers.begin(), headers.end());
}
-bool Request::AddRequestBody(const void* data, size_t size, ErrorPtr* error) {
+bool Request::AddRequestBody(const void* data,
+ size_t size,
+ chromeos::ErrorPtr* error) {
if (!SendRequestIfNeeded(error))
return false;
return connection_->WriteRequestData(data, size, error);
@@ -181,7 +183,7 @@
return user_agent_;
}
-bool Request::SendRequestIfNeeded(ErrorPtr* error) {
+bool Request::SendRequestIfNeeded(chromeos::ErrorPtr* error) {
if (transport_) {
if (!connection_) {
http::HeaderList headers = MapToVector(headers_);
@@ -221,8 +223,9 @@
if (connection_)
return true;
} else {
- Error::AddTo(error, http::curl::kErrorDomain,
- "request_already_received", "HTTP response already received");
+ chromeos::Error::AddTo(error, http::curl::kErrorDomain,
+ "request_already_received",
+ "HTTP response already received");
}
return false;
}