Skip to content

Commit

Permalink
Add error message for file not found
Browse files Browse the repository at this point in the history
Add an error message when trying to locate a non-existing file
inside an archive when using `extract-file`.
  • Loading branch information
Edythator committed Jan 24, 2022
1 parent 94cb8bd commit 90d279b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/filesystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ class Filesystem {
followLinks = typeof followLinks === 'undefined' ? true : followLinks
const info = this.getNode(p)

if (typeof info === 'undefined') {
console.error(`The file "${p}" was not found in the archive.`)
process.exit(1)
}

// if followLinks is false we don't resolve symlinks
if (info.link && followLinks) {
return this.getFile(info.link)
Expand Down

0 comments on commit 90d279b

Please sign in to comment.