From cca2ac71a715b78e802bb6dbe548bf79c48d0d24 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 5 Dec 2013 13:16:05 +0100 Subject: [PATCH] Error msg if the log file does not exist --- tools/nprof-stub.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/nprof-stub.js b/tools/nprof-stub.js index b70bacc..214c411 100644 --- a/tools/nprof-stub.js +++ b/tools/nprof-stub.js @@ -9,7 +9,13 @@ function print(s) { } function read(fileName) { - return require('fs').readFileSync(fileName, 'utf8'); + var fs = require('fs'); + if(fs.existsSync(fileName)) + return fs.readFileSync(fileName, 'utf8'); + else { + console.log("Error: File " + fileName + " does not exists"); + quit(1); + } } var readline = (function() {