Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Unified Diff: components/sync/model/model_error.h

Issue 2618483003: [Sync] Introduce ModelError for USS error handling. (Closed)
Patch Set: Address comments. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/sync/model/mock_model_type_store.cc ('k') | components/sync/model/model_error.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/model/model_error.h
diff --git a/components/sync/model/model_error.h b/components/sync/model/model_error.h
new file mode 100644
index 0000000000000000000000000000000000000000..e61816da37c1bd82802601466aaa321936c04ce4
--- /dev/null
+++ b/components/sync/model/model_error.h
@@ -0,0 +1,45 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_SYNC_MODEL_MODEL_ERROR_H_
+#define COMPONENTS_SYNC_MODEL_MODEL_ERROR_H_
+
+#include <string>
+
+#include "base/location.h"
+
+namespace syncer {
+
+// A minimal error object for use by USS model type code.
+class ModelError {
+ public:
+ // Creates an un-set error object (indicating an operation was successful).
+ ModelError();
+
+ // Creates a set error object with the given location and message.
+ ModelError(const tracked_objects::Location& location,
+ const std::string& message);
+
+ ~ModelError();
+
+ // Whether this object represents an actual error.
+ bool IsSet() const;
+
+ // The location of the error this object represents. Can only be called if the
+ // error is set.
+ const tracked_objects::Location& location() const;
+
+ // The message explaining the error this object represents. Can only be called
+ // if the error is set.
+ const std::string& message() const;
+
+ private:
+ bool is_set_;
+ tracked_objects::Location location_;
+ std::string message_;
+};
+
+} // namespace syncer
+
+#endif // COMPONENTS_SYNC_MODEL_MODEL_ERROR_H_
« no previous file with comments | « components/sync/model/mock_model_type_store.cc ('k') | components/sync/model/model_error.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698