-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add error message for file not found #227
base: main
Are you sure you want to change the base?
Conversation
Add an error message when trying to locate a non-existing file inside an archive when using `extract-file`.
90d279b
to
56e60b6
Compare
Tests seem to be failing, have you looked into what might be the cause of that? |
Seems like we need to update the xcode version for macOS CI to boot up. ref #223 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK with the spirit of the PR but not the implementation.
asar
is first and foremost a library, not a CLI. As such, it cannotprocess.exit
in the middle.- this needs tests so that any future changes don't regress the change.
Reworked the error handling to make it more "proper" as well as having added tests.
Hello, @malept. Sorry for not having understood the project's layout. I've now updated the branch in order to more accurately fit the requirements that this project needs. Please let me know if you have any further concerns. |
bin/asar.js
Outdated
const fileData = asar.extractFile(archive, filename) | ||
if (typeof fileData === 'undefined') { | ||
console.error(`The file "${filename}" was not found in the archive.`) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in the CLI part of the repository, so it makes more sense here to process.exit(1)
... although if an exception is thrown, the changes here probably aren't needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is in the CLI part of the repository, so it makes more sense here to
process.exit(1)
... although if an exception is thrown, the changes here probably aren't needed.
Yeah, I couldn't really add a process.exit(1)
to start with since that messes up the test.
Added an exception handler instead of relying on an if branch.
Add an error message when trying to locate a non-existing file inside an archive when using
extract-file
.