Index: src/messages.js |
diff --git a/src/messages.js b/src/messages.js |
index d20b34b07e26e587ef9e9e1e03637750fb1f8e33..44ae4b8c849dcb748d44c21f986bd026489a792b 100644 |
--- a/src/messages.js |
+++ b/src/messages.js |
@@ -162,7 +162,9 @@ var kMessages = { |
symbol_to_primitive: ["Cannot convert a Symbol wrapper object to a primitive value"], |
invalid_module_path: ["Module does not export '", "%0", "', or export is not itself a module"], |
module_type_error: ["Module '", "%0", "' used improperly"], |
- module_export_undefined: ["Export '", "%0", "' is not defined in module"] |
+ module_export_undefined: ["Export '", "%0", "' is not defined in module"], |
+ // Internal error. |
+ internal_error: ["Internal error"] |
}; |
@@ -349,6 +351,11 @@ function MakeError(type, args) { |
return MakeGenericError($Error, type, args); |
} |
+ |
+function MakeInternalError() { |
+ return MakeGenericError($InternalError, "internal_error"); |
+} |
+ |
/** |
* Find a line number given a specific source position. |
* @param {number} position The source position. |
@@ -1184,7 +1191,7 @@ function SetUpError() { |
%SetProperty(global, name, f, DONT_ENUM); |
%SetProperty(builtins, '$' + name, f, DONT_ENUM | DONT_DELETE | READ_ONLY); |
// Configure the error function. |
- if (name == 'Error') { |
+ if (name === 'Error') { |
// The prototype of the Error object must itself be an error. |
// However, it can't be an instance of the Error object because |
// it hasn't been properly configured yet. Instead we create a |
@@ -1193,7 +1200,7 @@ function SetUpError() { |
%FunctionSetPrototype(ErrorPrototype, $Object.prototype); |
%FunctionSetInstanceClassName(ErrorPrototype, 'Error'); |
%FunctionSetPrototype(f, new ErrorPrototype()); |
- } else { |
+ } else if (name !== 'InternalError') { |
%FunctionSetPrototype(f, new $Error()); |
} |
%FunctionSetInstanceClassName(f, 'Error'); |
@@ -1224,6 +1231,7 @@ function SetUpError() { |
DefineError(function ReferenceError() { }); |
DefineError(function EvalError() { }); |
DefineError(function URIError() { }); |
+ DefineError(function InternalError() { }); |
} |
SetUpError(); |