function RunAndQuit()

in BuildTools/djscommon.js [405:432]


function RunAndQuit(f) {
    try {
        f();
    }
    catch (e) {
        // An error with 'statusCode' defined will avoid the usual error dump handling.
        if (e.statusCode !== undefined) {
            if (e.message) {
                WScript.Echo(e.message);
            }

            WScript.Quit(e.statusCode);
        }

        WScript.Echo("Error caught while running this function:");
        WScript.Echo(f.toString());
        WScript.Echo("Error details:");
        if (typeof (e) == "object" && e.toString() == "[object Object]" || e.toString() === "[object Error]") {
            for (var p in e) WScript.Echo(" " + p + ": " + e[p]);
        }
        else {
            WScript.Echo(e);
        }

        WScript.Quit(1);
    }
    WScript.Quit(0);
}