diff --git a/lib/cli/options.js b/lib/cli/options.js index 2d9b2c9a..e09e6939 100644 --- a/lib/cli/options.js +++ b/lib/cli/options.js @@ -107,7 +107,14 @@ module.exports = yargs // Assert that image exists .check((argv) => { - fs.accessSync(argv._[IMAGE_PATH_ARGV_INDEX]); + const imagePath = argv._[IMAGE_PATH_ARGV_INDEX]; + + try { + fs.accessSync(imagePath); + } catch (error) { + throw errors.createUserError('Unable to access file', `The image ${imagePath} is not accessible`); + } + return true; })