-
Notifications
You must be signed in to change notification settings - Fork 932
feat: better error messages with human readable outputs #609
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
feat: better error messages with human readable outputs #609
Conversation
thymikee
left a comment
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.
Really nice work here, appreciate it! Here's some early feedback
|
@thymikee Thank you! A question: I have not been able to test the |
|
You need to |
|
@thymikee I am done with this, please review. |
grabbou
left a comment
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 like the direction this PR is moving. Is it already ready to be reviewed or merged? I left few comments and I am wondering what would be the next step now (it's been a while)
|
@grabbou thanks. Yes this is done and ready to be reviewed. I may have left some errors out (intentionally) because they don't make sense or slow down the performance. |
|
Uhm, looks like we have moved on with Typescript and other PRs in the meantime (unintentionally), making conflicts with this PR. I do really like it and was wondering if you'd be open to rebasing and preparing it for merging once again? |
|
@grabbou Okay I will begin the work ASAP. |
3cb73bc to
06b9cec
Compare
|
@thecodrr I took a stab at it and rebased your work. Please review if I didn't mess anything up :) |
|
@thymikee Everything looks perfect. : ) |
|
@thymikee ping |
Co-Authored-By: Michał Pierzchała <thymikee@gmail.com>
06b9cec to
879f9b8
Compare
grabbou
left a comment
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.
Great stuff! Did you like CLIError? I spent a bit of time working on this abstraction and I am happy that you found it useful here!
* refactor: properly handle invalid template package * refactor: error checks when getting template name * refactor: remove duplicate exception throw * refactor: check if assets dest exists * refactor: add error checks when upgrading * chore: add comment for using process.exit() * refactor: improve error outputs in link command * refactor: use for of loop * refactor: check package before uninstalling * refactor: use CLIError instead of direct exit * refactor: handle potential android pkg name errors * refactor: fix typos/mistakes in error outputs * refactor: add adb & android sdk path checks * refactor: fix imports * refactor: improve install apk error outputs * Apply suggestions from code review Co-Authored-By: Michał Pierzchała <thymikee@gmail.com> * refactor: add init doc link in error output * test: make sure all tests pass * refactor: use try/catch around readFileSync * refactor: do not read build.gradle twice * refactor: clean up code in android linking * fix: packageJson not defined in templateName * refactor: remove unintentional --verbose flag * refactor: make flow very happy * refactor: remove unnecessary variable definition * pkgjson undefined tweak * eslint fix * remove adb/android_home checks because we have doctor * use mockImplementationOnce * revert link changes, as it's going to be removed in next version * inline fns * revert uninstall changes as we're removing that in next version * adjust copy * mock existsSync once * remove unused code Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
| return Promise.resolve(); | ||
| } | ||
|
|
||
| if (!fs.existsSync(assetsDest)) { |
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.
hi @thecodrr @thymikee @grabbou,
I have a situation that I need to run bundle and copy assets into new created folder based on assetsDest and I was relying on https://github.com/react-native-community/cli/pull/609/files#diff-e59437386ac414095e6ed43a3da37303R93 to create folder if not exists.
Any specific reason that it needs to check assetsDest first before copying assets?
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.
Since we are calling mkdirp in the copy function, maybe this is no longer 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.
yes, i think it should be safe using mkdirp before copy files
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 check can be safely removed then. What do you think @thymikee?
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.
Please do
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.
Summary:
This is a work in progress and might take more than a little time.
These checks should add a little more context (and actionable output) when the script fails and reduce the number of false issues. All these handle potential points of failure e.g. invalid arguments, typos in provided file/dir paths or directories that no longer exist.
Adding a list here of all the commands that need to checked.
CLI
Android
Test Plan:
Only way to test is by failing all the checks one by one. 😆 Maybe more jest tests can be added to assure these comply?