Skip to content

Wrap callIfFunction in a try/catch #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions build/static_dist.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ var remove = Q.denodeify(fs.remove);
*
* 1. Copies everything from [bit-docs-generate-html/site/default/static] to
* [bit-docs-generate-html/site/static/build/buildHash].
*
*
* 2. Copies the path in `options.dest` to
* [bit-docs-generate-html/site/static/build/buildHash].
*
*
* 3. `require`s the "build" module at
* [bit-docs-generate-html/site/static/build/buildHash/build.js].
*
*
* 4. Calls that "build" module function with the options and returns the
* result.
*
Expand All @@ -43,13 +43,13 @@ var remove = Q.denodeify(fs.remove);
*
* @option {Boolean} [forceBuild=false] If set to `true`, rebuilds the static
* bundle even if it has already been built.
*
*
* @option {String} dest The final destination output of the static
* distributable.
*
* @option {String} static The location of static content used to overwrite or
* add to the default static content.
*
*
* @option {Boolean} [minifyBuild=true] If set to `false` the build will not be
* minified. This behavior should be implemented by the "build" module.
*
Expand Down Expand Up @@ -167,7 +167,7 @@ function installPackages(options, buildFolder, distFolder, hash){
if(options.debug) {
console.log("BUILD: Getting build module");
}

var build = require("../site/static/build/"+hash+"/build.js");
return build(options,{
dist: distFolder,
Expand All @@ -178,7 +178,9 @@ function installPackages(options, buildFolder, distFolder, hash){

function callIfFunction(value){
if(typeof value === "function") {
value();
try {
value();
} catch(e) {}
}
return value;
}