OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 18 matching lines...) Expand all Loading... |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "bindings/v8/ExceptionMessages.h" | 32 #include "bindings/v8/ExceptionMessages.h" |
33 | 33 |
34 #include "platform/Decimal.h" | 34 #include "platform/Decimal.h" |
35 #include "wtf/MathExtras.h" | 35 #include "wtf/MathExtras.h" |
36 | 36 |
37 namespace WebCore { | 37 namespace WebCore { |
38 | 38 |
39 String ExceptionMessages::failedToConstruct(const String& type, const String& de
tail) | 39 String ExceptionMessages::failedToConstruct(const char* type, const String& deta
il) |
40 { | 40 { |
41 return "Failed to construct '" + type + (!detail.isEmpty() ? String("': " +
detail) : String("'")); | 41 return "Failed to construct '" + String(type) + (!detail.isEmpty() ? String(
"': " + detail) : String("'")); |
42 } | 42 } |
43 | 43 |
44 String ExceptionMessages::failedToEnumerate(const String& type, const String& de
tail) | 44 String ExceptionMessages::failedToEnumerate(const char* type, const String& deta
il) |
45 { | 45 { |
46 return "Failed to enumerate the properties of '" + type + (!detail.isEmpty()
? String("': " + detail) : String("'")); | 46 return "Failed to enumerate the properties of '" + String(type) + (!detail.i
sEmpty() ? String("': " + detail) : String("'")); |
47 } | 47 } |
48 | 48 |
49 String ExceptionMessages::failedToExecute(const String& method, const String& ty
pe, const String& detail) | 49 String ExceptionMessages::failedToExecute(const char* method, const char* type,
const String& detail) |
50 { | 50 { |
51 return "Failed to execute '" + method + "' on '" + type + (!detail.isEmpty()
? String("': " + detail) : String("'")); | 51 return "Failed to execute '" + String(method) + "' on '" + String(type) + (!
detail.isEmpty() ? String("': " + detail) : String("'")); |
52 } | 52 } |
53 | 53 |
54 String ExceptionMessages::failedToGet(const String& property, const String& type
, const String& detail) | 54 String ExceptionMessages::failedToGet(const char* property, const char* type, co
nst String& detail) |
55 { | 55 { |
56 return "Failed to read the '" + property + "' property from '" + type + "':
" + detail; | 56 return "Failed to read the '" + String(property) + "' property from '" + Str
ing(type) + "': " + detail; |
57 } | 57 } |
58 | 58 |
59 String ExceptionMessages::failedToSet(const String& property, const String& type
, const String& detail) | 59 String ExceptionMessages::failedToSet(const char* property, const char* type, co
nst String& detail) |
60 { | 60 { |
61 return "Failed to set the '" + property + "' property on '" + type + "': " +
detail; | 61 return "Failed to set the '" + String(property) + "' property on '" + String
(type) + "': " + detail; |
62 } | 62 } |
63 | 63 |
64 String ExceptionMessages::failedToDelete(const String& property, const String& t
ype, const String& detail) | 64 String ExceptionMessages::failedToDelete(const char* property, const char* type,
const String& detail) |
65 { | 65 { |
66 return "Failed to delete the '" + property + "' property from '" + type + "'
: " + detail; | 66 return "Failed to delete the '" + String(property) + "' property from '" + S
tring(type) + "': " + detail; |
67 } | 67 } |
68 | 68 |
69 String ExceptionMessages::failedToGetIndexed(const String& type, const String& d
etail) | 69 String ExceptionMessages::failedToGetIndexed(const char* type, const String& det
ail) |
70 { | 70 { |
71 return "Failed to read an indexed property from '" + type + "': " + detail; | 71 return "Failed to read an indexed property from '" + String(type) + "': " +
detail; |
72 } | 72 } |
73 | 73 |
74 String ExceptionMessages::failedToSetIndexed(const String& type, const String& d
etail) | 74 String ExceptionMessages::failedToSetIndexed(const char* type, const String& det
ail) |
75 { | 75 { |
76 return "Failed to set an indexed property on '" + type + "': " + detail; | 76 return "Failed to set an indexed property on '" + String(type) + "': " + det
ail; |
77 } | 77 } |
78 | 78 |
79 String ExceptionMessages::failedToDeleteIndexed(const String& type, const String
& detail) | 79 String ExceptionMessages::failedToDeleteIndexed(const char* type, const String&
detail) |
80 { | 80 { |
81 return "Failed to delete an indexed property from '" + type + "': " + detail
; | 81 return "Failed to delete an indexed property from '" + String(type) + "': "
+ detail; |
82 } | 82 } |
83 | 83 |
84 String ExceptionMessages::constructorNotCallableAsFunction(const String& type) | 84 String ExceptionMessages::constructorNotCallableAsFunction(const char* type) |
85 { | 85 { |
86 return failedToConstruct(type, "Please use the 'new' operator, this DOM obje
ct constructor cannot be called as a function."); | 86 return failedToConstruct(type, "Please use the 'new' operator, this DOM obje
ct constructor cannot be called as a function."); |
87 } | 87 } |
88 | 88 |
89 String ExceptionMessages::incorrectPropertyType(const String& property, const St
ring& detail) | 89 String ExceptionMessages::incorrectPropertyType(const String& property, const St
ring& detail) |
90 { | 90 { |
91 return "The '" + property + "' property " + detail; | 91 return "The '" + property + "' property " + detail; |
92 } | 92 } |
93 | 93 |
94 String ExceptionMessages::argumentNullOrIncorrectType(int argumentIndex, const S
tring& expectedType) | 94 String ExceptionMessages::argumentNullOrIncorrectType(int argumentIndex, const S
tring& expectedType) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 return formatPotentiallyNonFiniteNumber(number); | 160 return formatPotentiallyNonFiniteNumber(number); |
161 } | 161 } |
162 | 162 |
163 template <> | 163 template <> |
164 String ExceptionMessages::formatNumber<double>(double number) | 164 String ExceptionMessages::formatNumber<double>(double number) |
165 { | 165 { |
166 return formatPotentiallyNonFiniteNumber(number); | 166 return formatPotentiallyNonFiniteNumber(number); |
167 } | 167 } |
168 | 168 |
169 } // namespace WebCore | 169 } // namespace WebCore |
OLD | NEW |