| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 HEADLESS_PUBLIC_UTIL_ERROR_REPORTER_H_ |
| 6 #define HEADLESS_PUBLIC_UTIL_ERROR_REPORTER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/strings/string_piece.h" |
| 12 #include "headless/public/headless_export.h" |
| 13 |
| 14 namespace headless { |
| 15 |
| 16 // Tracks errors which are encountered while parsing client API types. |
| 17 class HEADLESS_EXPORT ErrorReporter { |
| 18 public: |
| 19 ErrorReporter(); |
| 20 ~ErrorReporter(); |
| 21 |
| 22 // Enter a new nested parsing context. It will initially have a null name. |
| 23 void Push(); |
| 24 |
| 25 // Leave the current parsing context, returning to the previous one. |
| 26 void Pop(); |
| 27 |
| 28 // Set the name of the current parsing context. |name| must be a string with |
| 29 // application lifetime. |
| 30 void SetName(const char* name); |
| 31 |
| 32 // Report an error in the current parsing context. |
| 33 void AddError(base::StringPiece description); |
| 34 |
| 35 // Returns true if any errors have been reported so far. |
| 36 bool HasErrors() const; |
| 37 |
| 38 // Returns a list of reported errors. |
| 39 const std::vector<std::string>& errors() const { return errors_; } |
| 40 |
| 41 private: |
| 42 std::vector<const char*> path_; |
| 43 std::vector<std::string> errors_; |
| 44 }; |
| 45 |
| 46 } // namespace headless |
| 47 |
| 48 #endif // HEADLESS_PUBLIC_UTIL_ERROR_REPORTER_H_ |
| OLD | NEW |