buffet: Added advanced error reporting
Created chromeos::Error class that encapsulates rich error
information from various system domains.
Swept GCD device registration, HTTP transport and utilities
to always return additional error information when the caller
requests it. This includes internal errors, general HTTP errors
as well as parsing and returning specific GCD and OAuth2 server
error responses.
Also fixed a number of existing linter warnings.
BUG=chromium:366709
TEST=All existing and new unit tests pass.
Change-Id: Ic01622a8efa3dc365ec106e595b09536818b9b23
Reviewed-on: https://chromium-review.googlesource.com/198772
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_connection_fake.h b/buffet/http_connection_fake.h
index 26ca307..b412d75 100644
--- a/buffet/http_connection_fake.h
+++ b/buffet/http_connection_fake.h
@@ -27,9 +27,10 @@
// Overrides from http::Connection.
// See http_connection.h for description of these methods.
- virtual bool SendHeaders(const HeaderList& headers) override;
- virtual bool WriteRequestData(const void* data, size_t size) override;
- virtual bool FinishRequest() override;
+ virtual bool SendHeaders(const HeaderList& headers, ErrorPtr* error) override;
+ virtual bool WriteRequestData(const void* data, size_t size,
+ ErrorPtr* error) override;
+ virtual bool FinishRequest(ErrorPtr* error) override;
virtual int GetResponseStatusCode() const override;
virtual std::string GetResponseStatusText() const override;
@@ -38,12 +39,9 @@
const std::string& header_name) const override;
virtual uint64_t GetResponseDataSize() const override;
virtual bool ReadResponseData(void* data, size_t buffer_size,
- size_t* size_read) override;
- virtual std::string GetErrorMessage() const override;
+ size_t* size_read, ErrorPtr* error) override;
private:
- DISALLOW_COPY_AND_ASSIGN(Connection);
-
// Request and response objects passed to the user-provided request handler
// callback. The request object contains all the request information.
// The response object is the server response that is created by
@@ -53,10 +51,12 @@
// Internal read data pointer needed for ReadResponseData() implementation.
size_t response_data_ptr_ = 0;
+
+ DISALLOW_COPY_AND_ASSIGN(Connection);
};
} // namespace fake
} // namespace http
} // namespace chromeos
-#endif // BUFFET_HTTP_CONNECTION_FAKE_H_
+#endif // BUFFET_HTTP_CONNECTION_FAKE_H_