MCPcopy Create free account
hub / github.com/microsoft/SandDance / throwError

Function throwError

docs/app/js/sanddance-app.js:144076–144085  ·  view source on GitHub ↗
(token, messageFormat)

Source from the content-addressed store, hash-verified

144074 return node;
144075} // Throw an exception
144076function throwError(token, messageFormat) {
144077 var error, args = Array.prototype.slice.call(arguments, 2), msg = messageFormat.replace(/%(\d)/g, (whole, index1)=>{
144078 assert(index1 < args.length, "Message reference must be in range");
144079 return args[index1];
144080 });
144081 error = new Error(msg);
144082 error.index = index;
144083 error.description = msg;
144084 throw error;
144085} // Throw an exception because of the token.
144086function throwUnexpected(token) {
144087 if (token.type === TokenEOF) throwError(token, MessageUnexpectedEOS);
144088 if (token.type === TokenNumericLiteral) throwError(token, MessageUnexpectedNumber);

Callers 15

scanHexEscapeFunction · 0.70
getEscapedIdentifierFunction · 0.70
scanPunctuatorFunction · 0.70
scanHexLiteralFunction · 0.70
scanOctalLiteralFunction · 0.70
scanNumericLiteralFunction · 0.70
scanStringLiteralFunction · 0.70
testRegExpFunction · 0.70
scanRegExpBodyFunction · 0.70
scanRegExpFlagsFunction · 0.70
throwUnexpectedFunction · 0.70

Calls 2

replaceMethod · 0.80
assertFunction · 0.70

Tested by

no test coverage detected