OLD | NEW |
---|---|
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
203 "invalid_regexp_flags", ["Invalid flags supplied to RegExp constru ctor '", "%0", "'"], | 203 "invalid_regexp_flags", ["Invalid flags supplied to RegExp constru ctor '", "%0", "'"], |
204 "invalid_regexp", ["Invalid RegExp pattern /", "%0", "/"], | 204 "invalid_regexp", ["Invalid RegExp pattern /", "%0", "/"], |
205 "illegal_break", ["Illegal break statement"], | 205 "illegal_break", ["Illegal break statement"], |
206 "illegal_continue", ["Illegal continue statement"], | 206 "illegal_continue", ["Illegal continue statement"], |
207 "illegal_return", ["Illegal return statement"], | 207 "illegal_return", ["Illegal return statement"], |
208 "illegal_let", ["Illegal let declaration outside extended mode"], | 208 "illegal_let", ["Illegal let declaration outside extended mode"], |
209 "error_loading_debugger", ["Error loading debugger"], | 209 "error_loading_debugger", ["Error loading debugger"], |
210 "no_input_to_regexp", ["No input to ", "%0"], | 210 "no_input_to_regexp", ["No input to ", "%0"], |
211 "invalid_json", ["String '", "%0", "' is not valid JSON"], | 211 "invalid_json", ["String '", "%0", "' is not valid JSON"], |
212 "circular_structure", ["Converting circular structure to JSON"], | 212 "circular_structure", ["Converting circular structure to JSON"], |
213 "obj_ctor_property_non_object", ["Object.", "%0", " called on non-object"] , | 213 "called_on_non_object", ["%0", " called on non-object"], |
214 "called_on_null_or_undefined", ["%0", " called on null or undefined"], | 214 "called_on_null_or_undefined", ["%0", " called on null or undefined"], |
215 "array_indexof_not_defined", ["Array.getIndexOf: Argument undefined"], | 215 "array_indexof_not_defined", ["Array.getIndexOf: Argument undefined"], |
216 "object_not_extensible", ["Can't add property ", "%0", ", object is not extensible"], | 216 "object_not_extensible", ["Can't add property ", "%0", ", object is not extensible"], |
217 "illegal_access", ["Illegal access"], | 217 "illegal_access", ["Illegal access"], |
218 "invalid_preparser_data", ["Invalid preparser data for function ", " %0"], | 218 "invalid_preparser_data", ["Invalid preparser data for function ", " %0"], |
219 "strict_mode_with", ["Strict mode code may not include a with statement"], | 219 "strict_mode_with", ["Strict mode code may not include a with statement"], |
220 "strict_catch_variable", ["Catch variable may not be eval or argume nts in strict mode"], | 220 "strict_catch_variable", ["Catch variable may not be eval or argume nts in strict mode"], |
221 "too_many_arguments", ["Too many arguments in function call (onl y 32766 allowed)"], | 221 "too_many_arguments", ["Too many arguments in function call (onl y 32766 allowed)"], |
222 "too_many_parameters", ["Too many parameters in function definiti on (only 32766 allowed)"], | 222 "too_many_parameters", ["Too many parameters in function definiti on (only 32766 allowed)"], |
223 "too_many_variables", ["Too many variables declared (only 32767 allowed)"], | 223 "too_many_variables", ["Too many variables declared (only 32767 allowed)"], |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1183 message = IS_UNDEFINED(message) ? "" : TO_STRING_INLINE(message); | 1183 message = IS_UNDEFINED(message) ? "" : TO_STRING_INLINE(message); |
1184 if (name === "") return message; | 1184 if (name === "") return message; |
1185 if (message === "") return name; | 1185 if (message === "") return name; |
1186 return name + ": " + message; | 1186 return name + ": " + message; |
1187 } finally { | 1187 } finally { |
1188 visited_errors.length = visited_errors.length - 1; | 1188 visited_errors.length = visited_errors.length - 1; |
1189 } | 1189 } |
1190 } | 1190 } |
1191 | 1191 |
1192 function ErrorToString() { | 1192 function ErrorToString() { |
1193 if (IS_NULL_OR_UNDEFINED(this) && !IS_UNDETECTABLE(this)) { | 1193 if (!IS_SPEC_OBJECT(this)) { |
1194 throw MakeTypeError("called_on_null_or_undefined", | 1194 throw MakeTypeError("called_on_non_object", ["Error.toString"]); |
rossberg
2012/03/05 10:04:58
Shouldn't that be Error.prototype.toString?
Michael Starzinger
2012/03/05 12:55:59
Done. You are right. I thought this is consistent
| |
1195 ["Error.prototype.toString"]); | |
1196 } | 1195 } |
1197 | 1196 |
1198 try { | 1197 try { |
1199 return ErrorToStringDetectCycle(this); | 1198 return ErrorToStringDetectCycle(this); |
1200 } catch(e) { | 1199 } catch(e) { |
1201 // If this error message was encountered already return the empty | 1200 // If this error message was encountered already return the empty |
1202 // string for it instead of recursively formatting it. | 1201 // string for it instead of recursively formatting it. |
1203 if (e === cyclic_error_marker) { | 1202 if (e === cyclic_error_marker) { |
1204 return ''; | 1203 return ''; |
1205 } | 1204 } |
1206 throw e; | 1205 throw e; |
1207 } | 1206 } |
1208 } | 1207 } |
1209 | 1208 |
1210 | 1209 |
1211 InstallFunctions($Error.prototype, DONT_ENUM, ['toString', ErrorToString]); | 1210 InstallFunctions($Error.prototype, DONT_ENUM, ['toString', ErrorToString]); |
1212 | 1211 |
1213 // Boilerplate for exceptions for stack overflows. Used from | 1212 // Boilerplate for exceptions for stack overflows. Used from |
1214 // Isolate::StackOverflow(). | 1213 // Isolate::StackOverflow(). |
1215 var kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); | 1214 var kStackOverflowBoilerplate = MakeRangeError('stack_overflow', []); |
OLD | NEW |