Index: chrome/browser/sync/api/sync_error.cc |
diff --git a/chrome/browser/sync/api/sync_error.cc b/chrome/browser/sync/api/sync_error.cc |
index 453a920d70afcd9fef531775a3594b504b56b5c4..0023a05362e893089cb4f1498579680d551b843e 100644 |
--- a/chrome/browser/sync/api/sync_error.cc |
+++ b/chrome/browser/sync/api/sync_error.cc |
@@ -4,8 +4,11 @@ |
#include "chrome/browser/sync/api/sync_error.h" |
+#include <ostream> |
+ |
#include "base/location.h" |
#include "base/logging.h" |
+#include "chrome/browser/sync/syncable/model_type.h" |
SyncError::SyncError() { |
Clear(); |
@@ -83,6 +86,15 @@ syncable::ModelType SyncError::type() const { |
return type_; |
} |
+std::string SyncError::ToString() const { |
+ if (IsSet()) { |
+ return "{ location: " + location_->ToString() + ", type: " + |
+ syncable::ModelTypeToString(type()) + ", message: " + message() + "}"; |
+ } |
+ |
+ return "<Unset SyncError>"; |
+} |
+ |
void SyncError::PrintLogError() const { |
LAZY_STREAM(logging::LogMessage(location_->file_name(), |
location_->line_number(), |
@@ -90,3 +102,7 @@ void SyncError::PrintLogError() const { |
LOG_IS_ON(ERROR)) |
<< syncable::ModelTypeToString(type_) << " Sync Error: " << message_; |
} |
+ |
+void PrintTo(const SyncError& sync_error, std::ostream* os) { |
+ *os << sync_error.ToString(); |
+} |