OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SYNC_API_SYNC_ERROR_H_ | 5 #ifndef SYNC_API_SYNC_ERROR_H_ |
6 #define SYNC_API_SYNC_ERROR_H_ | 6 #define SYNC_API_SYNC_ERROR_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 // exposed through Chrome's "about:sync" internal page. | 22 // exposed through Chrome's "about:sync" internal page. |
23 // This class is copy-friendly and thread-safe. | 23 // This class is copy-friendly and thread-safe. |
24 class SYNC_EXPORT SyncError { | 24 class SYNC_EXPORT SyncError { |
25 public: | 25 public: |
26 // Error types are used to distinguish general datatype errors (which result | 26 // Error types are used to distinguish general datatype errors (which result |
27 // in the datatype being disabled) from actionable sync errors (which might | 27 // in the datatype being disabled) from actionable sync errors (which might |
28 // have more complicated results). | 28 // have more complicated results). |
29 enum ErrorType { | 29 enum ErrorType { |
30 UNSET, // No error. | 30 UNSET, // No error. |
31 UNRECOVERABLE_ERROR, // An unrecoverable runtime error was encountered, and | 31 UNRECOVERABLE_ERROR, // An unrecoverable runtime error was encountered, and |
32 // sync should be disabled completely. | 32 // sync should be disabled and purged completely. |
33 DATATYPE_ERROR, // A datatype error was encountered, and the datatype | 33 DATATYPE_ERROR, // A datatype error was encountered, and the datatype |
34 // should be disabled. | 34 // should be disabled and purged completely. Note that |
| 35 // datatype errors may be reset, triggering a |
| 36 // re-enable. |
35 PERSISTENCE_ERROR, // A persistence error was detected, and the | 37 PERSISTENCE_ERROR, // A persistence error was detected, and the |
36 // datataype should be associated after a sync update. | 38 // datataype should be associated after a sync update. |
37 CRYPTO_ERROR, // A cryptographer error was detected, and the | 39 CRYPTO_ERROR, // A cryptographer error was detected, and the |
38 // datatype should be associated after it is resolved. | 40 // datatype should be associated after it is resolved. |
| 41 UNREADY_ERROR, // The type is not ready to start yet, so should be |
| 42 // neither purged nor enabled until it is ready. |
39 }; | 43 }; |
40 | 44 |
41 // Default constructor refers to "no error", and IsSet() will return false. | 45 // Default constructor refers to "no error", and IsSet() will return false. |
42 SyncError(); | 46 SyncError(); |
43 | 47 |
44 // Create a new Sync error of type |error_type| triggered by |model_type| | 48 // Create a new Sync error of type |error_type| triggered by |model_type| |
45 // from the specified location. IsSet() will return true afterward. Will | 49 // from the specified location. IsSet() will return true afterward. Will |
46 // create and print an error specific message to LOG(ERROR). | 50 // create and print an error specific message to LOG(ERROR). |
47 SyncError(const tracked_objects::Location& location, | 51 SyncError(const tracked_objects::Location& location, |
48 ErrorType error_type, | 52 ErrorType error_type, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 ModelType model_type_; | 102 ModelType model_type_; |
99 ErrorType error_type_; | 103 ErrorType error_type_; |
100 }; | 104 }; |
101 | 105 |
102 // gmock printer helper. | 106 // gmock printer helper. |
103 SYNC_EXPORT void PrintTo(const SyncError& sync_error, std::ostream* os); | 107 SYNC_EXPORT void PrintTo(const SyncError& sync_error, std::ostream* os); |
104 | 108 |
105 } // namespace syncer | 109 } // namespace syncer |
106 | 110 |
107 #endif // SYNC_API_SYNC_ERROR_H_ | 111 #endif // SYNC_API_SYNC_ERROR_H_ |
OLD | NEW |