| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "extensions/renderer/api_invocation_errors.h" | 5 #include "extensions/renderer/api_invocation_errors.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 | 81 |
| 82 std::string UnserializableValue() { | 82 std::string UnserializableValue() { |
| 83 return "Value is unserializable."; | 83 return "Value is unserializable."; |
| 84 } | 84 } |
| 85 | 85 |
| 86 std::string ScriptThrewError() { | 86 std::string ScriptThrewError() { |
| 87 return "Script threw an error."; | 87 return "Script threw an error."; |
| 88 } | 88 } |
| 89 | 89 |
| 90 std::string TooManyArguments() { |
| 91 return "Too many arguments."; |
| 92 } |
| 93 |
| 94 std::string MissingRequiredArgument(const char* argument_name) { |
| 95 return base::StringPrintf("Missing required argument '%s'.", argument_name); |
| 96 } |
| 97 |
| 90 std::string IndexError(uint32_t index, const std::string& error) { | 98 std::string IndexError(uint32_t index, const std::string& error) { |
| 91 return base::StringPrintf("Error at index %u: %s", index, error.c_str()); | 99 return base::StringPrintf("Error at index %u: %s", index, error.c_str()); |
| 92 } | 100 } |
| 93 | 101 |
| 94 std::string PropertyError(const char* property_name, const std::string& error) { | 102 std::string PropertyError(const char* property_name, const std::string& error) { |
| 95 return base::StringPrintf("Error at property '%s': %s", property_name, | 103 return base::StringPrintf("Error at property '%s': %s", property_name, |
| 96 error.c_str()); | 104 error.c_str()); |
| 97 } | 105 } |
| 98 | 106 |
| 107 std::string ArgumentError(const std::string& parameter_name, |
| 108 const std::string& error) { |
| 109 return base::StringPrintf("Error at parameter '%s': %s", |
| 110 parameter_name.c_str(), error.c_str()); |
| 111 } |
| 112 |
| 99 } // namespace api_errors | 113 } // namespace api_errors |
| 100 } // namespace extensions | 114 } // namespace extensions |
| OLD | NEW |