From 279b71a2f344904e09d64923eac809d6938971af Mon Sep 17 00:00:00 2001 From: Anthony Ou Date: Fri, 17 Jun 2022 13:01:15 -0600 Subject: [PATCH] Handle input file errors --- package.json | 2 +- unmap.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 14bab25..3bc8337 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "source-map-unpacker", - "version": "1.5.3", + "version": "1.5.5", "description": "", "main": "unmap.js", "bin": { diff --git a/unmap.js b/unmap.js index d8fd32c..b620349 100755 --- a/unmap.js +++ b/unmap.js @@ -15,7 +15,12 @@ const opts = program fs.readFile(opts.path) .catch(async (e) => { - console.log("Input file does not exists"); + if (e.errno == -13) { + console.log("Insufficient permissions to read the tnput file."); + } + if (e.errno == -2) { + console.log("Input file does not exists."); + } process.exit(1); }) .then((js) => {