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

Side by Side Diff: headless/public/util/error_reporter.h

Issue 1867753005: headless: Add error reporter utility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DCHECK that path has no more components Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « headless/BUILD.gn ('k') | headless/public/util/error_reporter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_
OLDNEW
« no previous file with comments | « headless/BUILD.gn ('k') | headless/public/util/error_reporter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698