Chromium Code Reviews| 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 |
|
skym
2017/01/09 18:20:28
Hmm, this is actually looking a lot like an option
maxbogue
2017/01/09 21:29:33
I like the idea, but I'd like to leave it for a fo
|
| + // 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_ |