Skip to content

Commit 27b917c

Browse files
committed
added error checking to getbranches
1 parent b775a39 commit 27b917c

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/repository.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ export class Repository {
132132

133133
this.branch = await this.getCurrentBranch();
134134

135-
this.branches = await this.repository.getBranches();
135+
try {
136+
this.branches = await this.repository.getBranches();
137+
} catch (error) {
138+
console.error(error);
139+
}
136140

137141
this._onDidChangeStatus.fire();
138142

src/svn.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,18 +155,29 @@ export class Repository {
155155
.pop();
156156
return currentBranch;
157157
} catch (error) {
158+
console.error(error);
158159
return "";
159160
}
160161
}
161162

162163
async getBranches() {
163164
const info = await this.svn.info(this.root);
165+
166+
if (info.exitCode === 0) {
167+
throw new Error(info.stderr);
168+
}
169+
164170
const repoUrl = info.stdout
165171
.match(/<url>(.*?)<\/url>/)[1]
166172
.replace(/\/[^\/]+$/, "");
167173
const branchUrl = repoUrl + "/branches";
174+
168175
const result = await this.svn.list(branchUrl);
169176

177+
if (result.exitCode === 0) {
178+
throw new Error(result.stderr);
179+
}
180+
170181
const branches = result.stdout
171182
.trim()
172183
.replace(/\/|\\/g, "")

0 commit comments

Comments
 (0)