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

Side by Side Diff: extensions/renderer/api_invocation_errors.h

Issue 2947463002: [Extensions Bindings] Add a bindings/ subdirectory under renderer (Closed)
Patch Set: . Created 3 years, 6 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
OLDNEW
(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 EXTENSIONS_RENDERER_API_INVOCATION_ERRORS_H_
6 #define EXTENSIONS_RENDERER_API_INVOCATION_ERRORS_H_
7
8 #include <set>
9 #include <string>
10
11 #include "base/strings/string_piece.h"
12
13 // A collection of error-related strings and utilities for parsing API
14 // invocations.
15 namespace extensions {
16 namespace api_errors {
17
18 // Strings for the expected types.
19 extern const char kTypeString[];
20 extern const char kTypeDouble[];
21 extern const char kTypeBoolean[];
22 extern const char kTypeInteger[];
23 extern const char kTypeObject[];
24 extern const char kTypeList[];
25 extern const char kTypeBinary[];
26 extern const char kTypeFunction[];
27 extern const char kTypeUndefined[];
28 extern const char kTypeNull[];
29 extern const char kTypeAny[];
30
31 // Methods to return a formatted string describing an error related to argument
32 // parsing.
33 std::string InvalidEnumValue(const std::set<std::string>& valid_enums);
34 std::string MissingRequiredProperty(const char* property_name);
35 std::string UnexpectedProperty(const char* property_name);
36 std::string TooFewArrayItems(int minimum, int found);
37 std::string TooManyArrayItems(int maximum, int found);
38 std::string TooFewStringChars(int minimum, int found);
39 std::string TooManyStringChars(int maximum, int found);
40 std::string NumberTooSmall(int minimum);
41 std::string NumberTooLarge(int maximum);
42 std::string InvalidType(const char* expected_type, const char* actual_type);
43 std::string NotAnInstance(const char* instance_type);
44 std::string InvalidChoice();
45 std::string UnserializableValue();
46 std::string ScriptThrewError();
47 std::string TooManyArguments();
48 std::string MissingRequiredArgument(const char* argument_name);
49
50 // Returns an message indicating an error was found while parsing a given index
51 // in an array.
52 std::string IndexError(uint32_t index, const std::string& error);
53
54 // Returns a message indicating that an error was found while parsing a given
55 // property on an object.
56 std::string PropertyError(const char* property_name, const std::string& error);
57
58 // Returns a message indicating that an error was found while parsing a given
59 // parameter in an API signature.
60 std::string ArgumentError(const std::string& parameter_name,
61 const std::string& error);
62
63 // Returns a message indicating that an API method was called with an invalid
64 // signature.
65 std::string InvocationError(const std::string& method_name,
66 const std::string& expected_signature,
67 const std::string& error);
68
69 } // namespace api_errors
70 } // namespace extensions
71
72 #endif // EXTENSIONS_RENDERER_API_INVOCATION_ERRORS_H_
OLDNEW
« no previous file with comments | « extensions/renderer/api_event_listeners_unittest.cc ('k') | extensions/renderer/api_invocation_errors.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698