Skip to content

Commit 0cb927d

Browse files
authored
Merge pull request #51 from bit-docs/callifthrow
Wrap callIfFunction in a try/catch
2 parents 6c34d3c + 85d0edf commit 0cb927d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

build/static_dist.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ var remove = Q.denodeify(fs.remove);
2424
*
2525
* 1. Copies everything from [bit-docs-generate-html/site/default/static] to
2626
* [bit-docs-generate-html/site/static/build/buildHash].
27-
*
27+
*
2828
* 2. Copies the path in `options.dest` to
2929
* [bit-docs-generate-html/site/static/build/buildHash].
30-
*
30+
*
3131
* 3. `require`s the "build" module at
3232
* [bit-docs-generate-html/site/static/build/buildHash/build.js].
33-
*
33+
*
3434
* 4. Calls that "build" module function with the options and returns the
3535
* result.
3636
*
@@ -43,13 +43,13 @@ var remove = Q.denodeify(fs.remove);
4343
*
4444
* @option {Boolean} [forceBuild=false] If set to `true`, rebuilds the static
4545
* bundle even if it has already been built.
46-
*
46+
*
4747
* @option {String} dest The final destination output of the static
4848
* distributable.
4949
*
5050
* @option {String} static The location of static content used to overwrite or
5151
* add to the default static content.
52-
*
52+
*
5353
* @option {Boolean} [minifyBuild=true] If set to `false` the build will not be
5454
* minified. This behavior should be implemented by the "build" module.
5555
*
@@ -167,7 +167,7 @@ function installPackages(options, buildFolder, distFolder, hash){
167167
if(options.debug) {
168168
console.log("BUILD: Getting build module");
169169
}
170-
170+
171171
var build = require("../site/static/build/"+hash+"/build.js");
172172
return build(options,{
173173
dist: distFolder,
@@ -178,7 +178,9 @@ function installPackages(options, buildFolder, distFolder, hash){
178178

179179
function callIfFunction(value){
180180
if(typeof value === "function") {
181-
value();
181+
try {
182+
value();
183+
} catch(e) {}
182184
}
183185
return value;
184186
}

0 commit comments

Comments
 (0)