Skip to content

Commit 42ddd02

Browse files
committed
chore: remove initializeProjectDataSafe and use try/catch instead
1 parent 54435dc commit 42ddd02

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

lib/common/commands/device/get-file.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ export class GetFileCommand implements ICommand {
1212
let appIdentifier = args[1];
1313

1414
if (!appIdentifier) {
15-
this.$projectData.initializeProjectDataSafe();
15+
try {
16+
this.$projectData.initializeProjectData();
17+
} catch (err) {
18+
// ignore the error
19+
}
1620
if (!this.$projectData.projectIdentifiers) {
1721
this.$errors.failWithoutHelp("Please enter application identifier or execute this command in project.");
1822
}

lib/common/commands/device/list-files.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ export class ListFilesCommand implements ICommand {
1313
let appIdentifier = args[1];
1414

1515
if (!appIdentifier) {
16-
this.$projectData.initializeProjectDataSafe();
16+
try {
17+
this.$projectData.initializeProjectData();
18+
} catch (err) {
19+
// ignore the error
20+
}
1721
if (!this.$projectData.projectIdentifiers) {
1822
this.$errors.failWithoutHelp("Please enter application identifier or execute this command in project.");
1923
}

lib/common/commands/device/put-file.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ export class PutFileCommand implements ICommand {
1212
let appIdentifier = args[2];
1313

1414
if (!appIdentifier) {
15-
this.$projectData.initializeProjectDataSafe();
15+
try {
16+
this.$projectData.initializeProjectData();
17+
} catch (err) {
18+
// ignore the error
19+
}
1620
if (!this.$projectData.projectIdentifiers) {
1721
this.$errors.failWithoutHelp("Please enter application identifier or execute this command in project.");
1822
}

lib/project-data.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,6 @@ export class ProjectData implements IProjectData {
9090
this.errorInvalidProject(projectDir);
9191
}
9292

93-
public initializeProjectDataSafe(projectDir?: string): void {
94-
try {
95-
return this.initializeProjectData(projectDir);
96-
} catch (err) {
97-
// ignore the error
98-
}
99-
}
100-
10193
public initializeProjectDataFromContent(packageJsonContent: string, nsconfigContent: string, projectDir?: string): void {
10294
projectDir = projectDir || this.$projectHelper.projectDir || "";
10395
const projectFilePath = this.getProjectFilePath(projectDir);

test/stubs.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,6 @@ export class ProjectDataStub implements IProjectData {
336336
this.projectIdentifiers = { android: "", ios: "" };
337337
this.projectId = "";
338338
}
339-
public initializeProjectDataSafe(projectDir?: string): void {
340-
this.initializeProjectData(projectDir);
341-
}
342339
public initializeProjectDataFromContent(): void {
343340
return;
344341
}

0 commit comments

Comments
 (0)