Skip to content

Delete project directory if project creation doesn't succeed #15

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

Merged
merged 1 commit into from
Aug 8, 2014

Conversation

Fatme
Copy link
Contributor

@Fatme Fatme commented Aug 5, 2014

No description provided.

@Fatme Fatme closed this Aug 5, 2014
@Fatme Fatme reopened this Aug 5, 2014
@Fatme
Copy link
Contributor Author

Fatme commented Aug 5, 2014

@tailsu @ligaz

projectDir = path.join(projectDir, projectName);
this.$fs.createDirectory(projectDir).wait();
projectDir = path.join(projectDir, projectName);
this.$fs.createDirectory(projectDir).wait();
Copy link
Contributor

Choose a reason for hiding this comment

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

If createDirectory() fails, then the catch block will try to deleteDir() it. Is this intended?

Also, I think the code which cannot throw, which is all the code up to this line, should be outside the try block.

@Fatme
Copy link
Contributor Author

Fatme commented Aug 5, 2014

@teobugslayer


this.$logger.out("Project successfully created.");
} catch(ex) {
Copy link

Choose a reason for hiding this comment

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

It is better to name this just e or err because it is not an Exception but Error.

@ligaz
Copy link

ligaz commented Aug 6, 2014

You can extract createProjectCore and addPlatformCore methods that do the heavy lifting without catching any errors. In the main methods you can call the core with try-catch and handle the errors there.

@Fatme
Copy link
Contributor Author

Fatme commented Aug 6, 2014

@ligaz

@ligaz
Copy link

ligaz commented Aug 8, 2014

👍

Fatme added a commit that referenced this pull request Aug 8, 2014
Delete project directory if project creation doesn't succeed
@Fatme Fatme merged commit c916ae6 into master Aug 8, 2014
@Fatme Fatme deleted the fatme/delete-project-directory branch August 8, 2014 13:52
e2l3n pushed a commit to e2l3n/nativescript-cli that referenced this pull request Aug 31, 2015
rigor789 pushed a commit that referenced this pull request Feb 7, 2022
…-local

Fix check for android local builds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants