catch errors running registerCompiler callback

also, add XXX comments about the (very old) issue that source map
filenames are wrong for plugin files
This commit is contained in:
David Glasser
2015-06-30 02:23:44 -07:00
parent ef04a21dfd
commit 70cc03cfbf
6 changed files with 35 additions and 58 deletions

View File

@@ -27,11 +27,18 @@ _.extend(exports.SourceProcessor.prototype, {
} }
// XXX BBP proper error handling --- this is running user-supplied plugin // XXX BBP proper error handling --- this is running user-supplied plugin
// code, and use markBoundary too // code, and use markBoundary too
self.userPlugin = self.factoryFunction.call(null); try {
// If we have a disk cache directory and the plugin wants it, use it. self.userPlugin = buildmessage.markBoundary(self.factoryFunction).call(
// XXX BBP proper error handling null);
if (self.isopack.pluginCacheDir && self.userPlugin.setDiskCacheDirectory) { // If we have a disk cache directory and the plugin wants it, use it.
self.userPlugin.setDiskCacheDirectory(self.isopack.pluginCacheDir); if (self.isopack.pluginCacheDir &&
self.userPlugin.setDiskCacheDirectory) {
const markedMethod = buildmessage.markBoundary(
self.userPlugin.setDiskCacheDirectory.bind(self.userPlugin));
markedMethod(self.isopack.pluginCacheDir);
}
} catch (e) {
buildmessage.exception(e);
} }
}, },
relevantForArch: function (arch) { relevantForArch: function (arch) {

View File

@@ -1,2 +0,0 @@
server
browser

View File

@@ -1,49 +0,0 @@
autopublish@1.0.3
autoupdate@1.2.1
base64@1.0.3
binary-heap@1.0.3
blaze@2.1.2
blaze-tools@1.0.3
boilerplate-generator@1.0.3
build-plugin@0.0.1
callback-hook@1.0.3
check@1.0.5
ddp@1.1.0
deps@1.0.7
ejson@1.0.6
fastclick@1.0.3
geojson-utils@1.0.3
html-tools@1.0.4
htmljs@1.0.4
http@1.1.0
id-map@1.0.3
insecure@1.0.3
jquery@1.11.3_2
json@1.0.3
launch-screen@1.0.2
livedata@1.0.13
logging@1.0.7
meteor@1.1.6
meteor-platform@1.2.2
minifiers@1.1.5
minimongo@1.0.8
mobile-status-bar@1.0.3
mongo@1.1.0
observe-sequence@1.0.6
ordered-dict@1.0.3
random@1.0.3
reactive-dict@1.1.0
reactive-var@1.0.5
reload@1.1.3
retry@1.0.3
routepolicy@1.0.5
session@1.1.0
spacebars@1.0.6
spacebars-compiler@1.0.6
templating@1.1.1
tracker@1.0.7
ui@1.0.6
underscore@1.0.3
url@1.0.4
webapp@1.2.0
webapp-hashing@1.0.3

View File

@@ -11,6 +11,6 @@ Package.describe({
}); });
Package.registerBuildPlugin({ Package.registerBuildPlugin({
name: "build-plugin", name: "build-plugin-itself",
sources: [ "build-plugin.js" ] sources: [ "build-plugin.js" ]
}); });

View File

@@ -240,3 +240,21 @@ selftest.define("compiler plugins - inactive source", () => {
run.stop(); run.stop();
}); });
// Test error when the registerCompiler callback throws.
selftest.define("compiler plugins - compiler throws", () => {
const s = new Sandbox({ fakeMongo: true });
s.createApp('myapp', 'compiler-plugin-throws-on-instantiate');
s.cd('myapp');
const run = s.run('add', 'local-plugin');
run.matchErr('Errors while adding packages');
run.matchErr('While building package local-plugin');
// XXX This is wrong! The path on disk is packages/local-plugin/plugin.js, but
// at some point we switched to the servePath which is based on the *plugin*'s
// "package" name.
run.matchErr('packages/compilePrintme/plugin.js:5:1: Error in my ' +
'registerCompiler callback!');
run.expectExit(1);
});

View File

@@ -89,6 +89,9 @@ selftest.define("source maps from a build plugin implementation", ['checkout'],
s.cd("myapp"); s.cd("myapp");
var run = s.run("run"); var run = s.run("run");
run.waitSecs(10); run.waitSecs(10);
run.match(/packages\/build-plugin\/build-plugin.js:2:1/); // XXX This is wrong! The path on disk is
// packages/build-plugin/build-plugin.js, but at some point we switched to the
// servePath which is based on the *plugin*'s "package" name.
run.match(/packages\/build-plugin-itself\/build-plugin.js:2:1/);
run.stop(); run.stop();
}); });