| 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 COMPONENTS_SYNC_API_SYNC_ERROR_H_ | 5 #ifndef COMPONENTS_SYNC_API_SYNC_ERROR_H_ |
| 6 #define COMPONENTS_SYNC_API_SYNC_ERROR_H_ | 6 #define COMPONENTS_SYNC_API_SYNC_ERROR_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "components/sync/base/model_type.h" | 12 #include "components/sync/base/model_type.h" |
| 13 #include "components/sync/base/sync_export.h" | |
| 14 | 13 |
| 15 namespace tracked_objects { | 14 namespace tracked_objects { |
| 16 class Location; | 15 class Location; |
| 17 } // namespace tracked_objects | 16 } // namespace tracked_objects |
| 18 | 17 |
| 19 namespace syncer { | 18 namespace syncer { |
| 20 | 19 |
| 21 // Sync errors are used for debug purposes and handled internally and/or | 20 // Sync errors are used for debug purposes and handled internally and/or |
| 22 // exposed through Chrome's "about:sync" internal page. | 21 // exposed through Chrome's "about:sync" internal page. |
| 23 // This class is copy-friendly and thread-safe. | 22 // This class is copy-friendly and thread-safe. |
| 24 class SYNC_EXPORT SyncError { | 23 class SyncError { |
| 25 public: | 24 public: |
| 26 // Error types are used to distinguish general datatype errors (which result | 25 // Error types are used to distinguish general datatype errors (which result |
| 27 // in the datatype being disabled) from actionable sync errors (which might | 26 // in the datatype being disabled) from actionable sync errors (which might |
| 28 // have more complicated results). | 27 // have more complicated results). |
| 29 enum ErrorType { | 28 enum ErrorType { |
| 30 UNSET, // No error. | 29 UNSET, // No error. |
| 31 UNRECOVERABLE_ERROR, // An unrecoverable runtime error was encountered, | 30 UNRECOVERABLE_ERROR, // An unrecoverable runtime error was encountered, |
| 32 // and sync should be disabled and purged completely. | 31 // and sync should be disabled and purged completely. |
| 33 DATATYPE_ERROR, // A datatype error was encountered, and the datatype | 32 DATATYPE_ERROR, // A datatype error was encountered, and the datatype |
| 34 // should be disabled and purged completely. Note | 33 // should be disabled and purged completely. Note |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void Clear(); | 114 void Clear(); |
| 116 | 115 |
| 117 // unique_ptr is necessary because Location objects aren't assignable. | 116 // unique_ptr is necessary because Location objects aren't assignable. |
| 118 std::unique_ptr<tracked_objects::Location> location_; | 117 std::unique_ptr<tracked_objects::Location> location_; |
| 119 std::string message_; | 118 std::string message_; |
| 120 ModelType model_type_; | 119 ModelType model_type_; |
| 121 ErrorType error_type_; | 120 ErrorType error_type_; |
| 122 }; | 121 }; |
| 123 | 122 |
| 124 // gmock printer helper. | 123 // gmock printer helper. |
| 125 SYNC_EXPORT void PrintTo(const SyncError& sync_error, std::ostream* os); | 124 void PrintTo(const SyncError& sync_error, std::ostream* os); |
| 126 | 125 |
| 127 } // namespace syncer | 126 } // namespace syncer |
| 128 | 127 |
| 129 #endif // COMPONENTS_SYNC_API_SYNC_ERROR_H_ | 128 #endif // COMPONENTS_SYNC_API_SYNC_ERROR_H_ |
| OLD | NEW |