| Index: sync/api/sync_error.h
|
| diff --git a/sync/api/sync_error.h b/sync/api/sync_error.h
|
| index e9ca0f60825c0893cf63c86cf4a8a523762cb1c0..306ed83fc72421b1bef249dfe04d6b2d4cc9b7ac 100644
|
| --- a/sync/api/sync_error.h
|
| +++ b/sync/api/sync_error.h
|
| @@ -19,21 +19,35 @@ class Location;
|
| namespace syncer {
|
|
|
| // Sync errors are used for debug purposes and handled internally and/or
|
| -// exposed through Chrome's "about:sync" internal page. They are considered
|
| -// unrecoverable for the datatype creating them, and should only be used as
|
| -// such.
|
| +// exposed through Chrome's "about:sync" internal page.
|
| // This class is copy-friendly and thread-safe.
|
| class SYNC_EXPORT SyncError {
|
| public:
|
| + // Error types are used to distinguish general datatype errors (which result
|
| + // in the datatype being disabled) from actionable sync errors (which might
|
| + // have more complicated results).
|
| + enum ErrorType {
|
| + UNSET, // No error.
|
| + UNRECOVERABLE_ERROR, // An unrecoverable runtime error was encountered, and
|
| + // sync should be disabled completely.
|
| + DATATYPE_ERROR, // A datatype error was encountered, and the datatype
|
| + // should be disabled.
|
| + PERSISTENCE_ERROR, // A persistence error was detected, and the
|
| + // datataype should be associated after a sync update.
|
| + CRYPTO_ERROR, // A cryptographer error was detected, and the
|
| + // datatype should be associated after it is resolved.
|
| + };
|
| +
|
| // Default constructor refers to "no error", and IsSet() will return false.
|
| SyncError();
|
|
|
| - // Create a new Sync error triggered by datatype |type| with debug message
|
| - // |message| from the specified location. IsSet() will return true.
|
| - // Will print the new error to LOG(ERROR).
|
| + // Create a new Sync error of type |error_type| triggered by |model_type|
|
| + // from the specified location. IsSet() will return true afterward. Will
|
| + // create and print an error specific message to LOG(ERROR).
|
| SyncError(const tracked_objects::Location& location,
|
| + ErrorType error_type,
|
| const std::string& message,
|
| - ModelType type);
|
| + ModelType model_type);
|
|
|
| // Copy and assign via deep copy.
|
| SyncError(const SyncError& other);
|
| @@ -41,8 +55,9 @@ class SYNC_EXPORT SyncError {
|
|
|
| ~SyncError();
|
|
|
| - // Reset the current error to a new error. May be called irrespective of
|
| - // whether IsSet() is true. After this is called, IsSet() will return true.
|
| + // Reset the current error to a new datatype error. May be called
|
| + // irrespective of whether IsSet() is true. After this is called, IsSet()
|
| + // will return true.
|
| // Will print the new error to LOG(ERROR).
|
| void Reset(const tracked_objects::Location& location,
|
| const std::string& message,
|
| @@ -54,7 +69,8 @@ class SYNC_EXPORT SyncError {
|
| // These must only be called if IsSet() is true.
|
| const tracked_objects::Location& location() const;
|
| const std::string& message() const;
|
| - ModelType type() const;
|
| + ModelType model_type() const;
|
| + ErrorType error_type() const;
|
|
|
| // Returns empty string is IsSet() is false.
|
| std::string ToString() const;
|
| @@ -70,7 +86,8 @@ class SYNC_EXPORT SyncError {
|
| // is called, IsSet() will return true.
|
| void Init(const tracked_objects::Location& location,
|
| const std::string& message,
|
| - ModelType type);
|
| + ModelType model_type,
|
| + ErrorType error_type);
|
|
|
| // Reset the error to it's default (unset) values.
|
| void Clear();
|
| @@ -78,7 +95,8 @@ class SYNC_EXPORT SyncError {
|
| // scoped_ptr is necessary because Location objects aren't assignable.
|
| scoped_ptr<tracked_objects::Location> location_;
|
| std::string message_;
|
| - ModelType type_;
|
| + ModelType model_type_;
|
| + ErrorType error_type_;
|
| };
|
|
|
| // gmock printer helper.
|
|
|