Skip to content
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: Correctly display errors in react-native init #2394

Merged
merged 5 commits into from
Sep 9, 2024

Conversation

islandryu
Copy link
Contributor

Summary:

The problem I noticed was that when I specified the wrong template, the error wording was funny.

$ react-native init TestProduct --template typescript
                                                          
               ######                ######               
             ###     ####        ####     ###             
            ##          ###    ###          ##            
            ##             ####             ##            
            ##             ####             ##            
            ##           ##    ##           ##            
            ##         ###      ###         ##            
             ##  ########################  ##             
          ######    ###            ###    ######          
      ###     ##    ##              ##    ##     ###      
   ###         ## ###      ####      ### ##         ###   
  ##           ####      ########      ####           ##  
 ##             ###     ##########     ###             ## 
  ##           ####      ########      ####           ##  
   ###         ## ###      ####      ### ##         ###   
      ###     ##    ##              ##    ##     ###      
          ######    ###            ###    ######          
             ##  ########################  ##             
            ##         ###      ###         ##            
            ##           ##    ##           ##            
            ##             ####             ##            
            ##             ####             ##            
            ##          ###    ###          ##            
             ###     ####        ####     ###             
               ######                ######               
                                                          

                  Welcome to React Native!                
                 Learn once, write anywhere               

✔ Downloading template
⠋ Copying templateerror Installing pods failed. This doesn't affect project initialization and you can safely proceed. 
However, you will need to install pods manually when running iOS, follow additional steps in "Run instructions for iOS" section.

However, looking at the source code, this issue as well as many other errors are not displayed correctly.
The error handling part of cocoapods seems to be wrong.
Moved pods error handling out of the way of the others, and added additional unknown error handling.

Test Plan:

Run react-native init TestProduct --template typescript and check correct error message.
Confirmation of pod error on pod failure.

Checklist

  • Documentation is up to date to reflect these changes.
  • Follows commit message convention described in CONTRIBUTING.md

Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you for contributing this! Can you please rebase to resolve conflicts?

@szymonrybczak szymonrybczak force-pushed the fix/errorHandle branch 3 times, most recently from d3ce962 to fb440f8 Compare July 4, 2024 13:26
@szymonrybczak szymonrybczak requested a review from thymikee August 27, 2024 15:59
@thymikee thymikee merged commit 0e1c828 into react-native-community:main Sep 9, 2024
10 checks passed
thymikee pushed a commit that referenced this pull request Sep 12, 2024
* fix: Display correct error when config file does not exist

* fix: move cocoaPods Error

* fix: prettify output

* fix: pass an error

* fix: do cleanup before exiting process

---------

Co-authored-by: szymonrybczak <szymon.rybczak@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants