From b8c9508d2196044760a7b1273b4635c970bb313b Mon Sep 17 00:00:00 2001 From: philkunz Date: Sat, 20 Aug 2016 07:15:52 +0200 Subject: [PATCH] try catch for execution time --- dist/index.js | 11 +++++++++-- ts/index.ts | 9 ++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/dist/index.js b/dist/index.js index 9c33a04..fbe2829 100644 --- a/dist/index.js +++ b/dist/index.js @@ -35,7 +35,14 @@ exports.start = function (moduleNameArg = "", loaderLengthArg = "10") { exports.stop = function () { let done = q.defer(); let endTime = process.hrtime(startTime); - let executionTime = (endTime[0] * 1e9 + endTime[1]) / 1000000000; + let executionTime = function () { + try { + return (endTime[0] * 1e9 + endTime[1]); + } + catch (err) { + return undefined; + } + }() / 1000000000; if (doAnimation) { earlyChild.kill("SIGHUP"); earlyChild.on("close", function () { @@ -49,4 +56,4 @@ exports.stop = function () { } return done.promise; }; -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFDUCxDQUFDLENBRHNCO0FBQ3ZCLE1BQU8sSUFBSSxXQUFXLE1BQU0sQ0FBQyxDQUFDO0FBQzlCLE1BQU8sS0FBSyxXQUFXLE9BQU8sQ0FBQyxDQUFDO0FBQ2hDLElBQUksQ0FBQyxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUVyQixNQUFPLFlBQVksV0FBVyxlQUFlLENBQUMsQ0FBQztBQUMvQyxJQUFJLFVBQVUsQ0FBQztBQUVmLElBQUksV0FBVyxHQUFZLElBQUksQ0FBQztBQUNoQyxJQUFJLE1BQU0sR0FBWSxLQUFLLENBQUM7QUFDNUIsSUFBSSxVQUFVLEdBQVUsdUJBQXVCLENBQUM7QUFDaEQsSUFBSSxTQUFTLENBQUM7Q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UFDLENBQUMsQ0FBQztRQUNkLFVBQVUsQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLENBQUM7UUFDMUIsVUFBVSxDQUFDLEVBQUUsQ0FBQyxPQUFPLEVBQUU7WUFDbkIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLGFBQWEsV0FBVyxDQUFDLENBQUM7WUFDN0MsSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO1FBQ25CLENBQUMsQ0FBQyxDQUFBO0lBQ04sQ0FBQztJQUFDLElBQUksQ0FBQyxDQUFDO1FBQ0osT0FBTyxDQUFDLEdBQUcsQ0FBQyxzQ0FBc0MsYUFBYSxFQUFFLENBQUMsQ0FBQztRQUNuRSxJQUFJLENBQUMsT0FBTyxFQUFFLENBQUM7SUFDbkIsQ0FBQztJQUNELE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDO0FBQ3hCLENBQUMsQ0FBQyJ9 \ No newline at end of file diff --git a/ts/index.ts b/ts/index.ts index 62003db..c0372c1 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -39,7 +39,14 @@ export let start = function (moduleNameArg: string = "", loaderLengthArg: string export let stop = function () { let done = q.defer(); let endTime = process.hrtime(startTime); - let executionTime = (endTime[0] * 1e9 + endTime[1]) / 1000000000; + let executionTime = function(){ + try { + return(endTime[0] * 1e9 + endTime[1]); + } + catch(err){ + return undefined; + } + }() / 1000000000; if (doAnimation) { earlyChild.kill("SIGHUP"); earlyChild.on("close", function () {