从构建配置任务(alloy.jmk)停止合金构建

时间:2017-06-08 11:19:32

标签: makefile titanium-alloy appcelerator-alloy buildconfiguration

让我说我有以下任务修改我的Alloy编译过程(alloy.jmk构建配置文件)

task("pre:compile", function (e, log) {

    // execute something that may throw an error
    try {
        // ...
    }
    catch(err) {
        // do some custom error handling 
        // ...
        // !!! need to stop the build here !!!
    }

    log.info("My task completed!");
});

如何停止catch子句中的构建?当然我可以删除try-catch但是我的自定义错误处理不会被执行......

1 个答案:

答案 0 :(得分:0)

好吧,在这里回答我自己的问题......看起来太简单了......只需在catch语句中抛出一个自定义错误就好了

task("pre:compile", function (e, log) {

    // execute something that may throw an error
    try {
        // ...
    }
    catch(err) {
        // do some custom error handling 
        // ...
        throw('throwing some error to stop the build');
    }

    log.info("My task completed!");
});
相关问题