Makefile 从生成配置任务(alloy.jmk)停止alloy生成

Makefile 从生成配置任务(alloy.jmk)停止alloy生成,makefile,titanium-alloy,appcelerator-alloy,buildconfiguration,Makefile,Titanium Alloy,Appcelerator Alloy,Buildconfiguration,假设我有以下任务修改Alloy编译过程(Alloy.jmk构建配置文件) 如何在catch子句中停止生成?当然,我可以删除try-catch,但是我的自定义错误处理将不会执行…好吧,在这里回答我自己的问题。。。看起来太容易了。。。只需在catch语句中抛出一个自定义错误,如下所示 task("pre:compile", function (e, log) { // execute something that may throw an error try { /

假设我有以下任务修改Alloy编译过程(Alloy.jmk构建配置文件)


如何在catch子句中停止生成?当然,我可以删除try-catch,但是我的自定义错误处理将不会执行…

好吧,在这里回答我自己的问题。。。看起来太容易了。。。只需在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!");
});
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!");
});