Throw more detailed error when compilation fails (#18783)

* Throw more detailed error when compilation fails

* Add SQL edits
This commit is contained in:
Charles Gagnon
2022-03-24 13:20:18 -07:00
committed by GitHub
parent 5e68ff1dfe
commit f325a2df08

View File

@@ -789,7 +789,13 @@ var AMDLoader;
catch (_e) {
recorder.record(61 /* CachedDataMissed */, cachedDataPath);
}
var script = new that._vm.Script(scriptSource, options);
// {{SQL CARBON EDIT}} Add more details to compile error
var script;
try {
script = new that._vm.Script(scriptSource, options);
} catch (err) {
throw new Error(`Error compiling ${filename}. ${err}`);
}
var compileWrapper = script.runInThisContext(options);
// run script
var dirname = that._path.dirname(filename);
@@ -852,7 +858,13 @@ var AMDLoader;
NodeScriptLoader.prototype._createAndEvalScript = function (moduleManager, contents, options, callback, errorback) {
var recorder = moduleManager.getRecorder();
recorder.record(31 /* NodeBeginEvaluatingScript */, options.filename);
var script = new this._vm.Script(contents, options);
// {{SQL CARBON EDIT}} Add more details to compile error
var script;
try {
script = new this._vm.Script(contents, options);
} catch (err) {
throw new Error(`Error compiling ${options.filename}. ${err}`);
}
var ret = script.runInThisContext(options);
var globalDefineFunc = moduleManager.getGlobalAMDDefineFunc();
var receivedDefineCall = false;