Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_SYNC_MODEL_MODEL_ERROR_H_ | |
| 6 #define COMPONENTS_SYNC_MODEL_MODEL_ERROR_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/location.h" | |
| 11 | |
| 12 namespace syncer { | |
| 13 | |
| 14 // A minimal error object for use by USS model type code. | |
| 15 class ModelError { | |
| 16 public: | |
| 17 // Creates an un-set error object (indicating an operation was successful). | |
| 18 ModelError(); | |
| 19 | |
| 20 // Creates a set error object with the given location and message. | |
| 21 ModelError(const tracked_objects::Location& location, | |
| 22 const std::string& message); | |
| 23 | |
| 24 ~ModelError(); | |
| 25 | |
| 26 // Whether this object represents an actual error. | |
| 27 bool IsSet() const; | |
| 28 | |
| 29 // 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
| |
| 30 // error is set. | |
| 31 const tracked_objects::Location& location() const; | |
| 32 | |
| 33 // The message explaining the error this object represents. Can only be called | |
| 34 // if the error is set. | |
| 35 const std::string& message() const; | |
| 36 | |
| 37 private: | |
| 38 bool is_set_; | |
| 39 tracked_objects::Location location_; | |
| 40 std::string message_; | |
| 41 }; | |
| 42 | |
| 43 } // namespace syncer | |
| 44 | |
| 45 #endif // COMPONENTS_SYNC_MODEL_MODEL_ERROR_H_ | |
| OLD | NEW |