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 6ffa495466bc9e13b6a8ce18790db7e354ed8ac6..743ae995ef247776a4b2872770b18e503e5eb507 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/logging.h" |
#include "base/tracked.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_->ToString() + ", " + ", " + |
akalin
2011/09/22 02:59:44
return "{ location: " + ... + ", type: " + ... ",
James Hawkins
2011/09/22 21:01:58
Done.
|
+ syncable::ModelTypeToString(type()) + ", " + 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(); |
+} |