Skip to content

Commit fc13a64

Browse files
committed
chore: reveiwed uncaught exception handlers in git
1 parent ca0834c commit fc13a64

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

src/extensions/default/Git/src/Panel.js

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -742,7 +742,7 @@ define(function (require, exports) {
742742
}
743743

744744
p.catch(function (err) {
745-
ErrorHandler.showError(err, "Preparing commit dialog failed");
745+
ErrorHandler.showError(err, Strings.ERROR_PREPARING_COMMIT_DIALOG);
746746
}).finally(function () {
747747
Utils.unsetLoading($gitPanel.find(".git-commit"));
748748
});
@@ -956,7 +956,12 @@ define(function (require, exports) {
956956
return Git.resetIndex();
957957
})
958958
.then(function () {
959-
return handleGitCommit(lastCommitMessage[ProjectManager.getProjectRoot().fullPath], false, COMMIT_MODE.CURRENT);
959+
return handleGitCommit(lastCommitMessage[ProjectManager.getProjectRoot().fullPath],
960+
false, COMMIT_MODE.CURRENT);
961+
}).catch((err)=>{
962+
console.error(err);
963+
// rethrowing with stripped git error details as it may have sensitive info
964+
throw new Error("Error commitCurrentFile in git panel.js. this should not have happened here.");
960965
});
961966
}
962967

@@ -967,7 +972,12 @@ define(function (require, exports) {
967972
return Git.resetIndex();
968973
})
969974
.then(function () {
970-
return handleGitCommit(lastCommitMessage[ProjectManager.getProjectRoot().fullPath], false, COMMIT_MODE.ALL);
975+
return handleGitCommit(lastCommitMessage[ProjectManager.getProjectRoot().fullPath],
976+
false, COMMIT_MODE.ALL);
977+
}).catch((err)=>{
978+
console.error(err);
979+
// rethrowing with stripped git error details as it may have sensitive info
980+
throw new Error("Error commitAllFiles in git panel.js. this should not have happened here.");
971981
});
972982
}
973983

@@ -1232,13 +1242,20 @@ define(function (require, exports) {
12321242
.on("click", ".check-all", function () {
12331243
if ($(this).is(":checked")) {
12341244
return Git.stageAll().then(function () {
1235-
Git.status();
1236-
});
1237-
} else {
1238-
return Git.resetIndex().then(function () {
1239-
Git.status();
1245+
return Git.status();
1246+
}).catch((err)=>{
1247+
console.error(err);
1248+
// rethrowing with stripped git error details as it may have sensitive info
1249+
throw new Error("Error stage all by checkbox in git panel.js. this should not have happened");
12401250
});
12411251
}
1252+
return Git.resetIndex().then(function () {
1253+
return Git.status();
1254+
}).catch((err)=>{
1255+
console.error(err);
1256+
// rethrowing with stripped git error details as it may have sensitive info
1257+
throw new Error("Error unstage all by checkbox in git panel.js. this should not have happened");
1258+
});
12421259
})
12431260
.on("click", ".git-refresh", EventEmitter.getEmitter(Events.REFRESH_ALL, ["panel", "refreshBtn"]))
12441261
.on("click", ".git-commit", EventEmitter.getEmitter(Events.HANDLE_GIT_COMMIT))

src/nls/root/strings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1529,6 +1529,7 @@ define({
15291529
"ERROR_NO_REMOTE_SELECTED": "No remote has been selected for {0}!",
15301530
"ERROR_BRANCH_LIST": "Getting branch list failed",
15311531
"ERROR_FETCH_REMOTE": "Fetching remote information failed",
1532+
"ERROR_PREPARING_COMMIT_DIALOG": "Preparing commit dialog failed",
15321533
"GIT_TOAST_TITLE": "Explore Git Features in Phoenix Code",
15331534
"GIT_TOAST_MESSAGE": "Click the Git panel icon to manage your repository. Easily commit, push, pull, and view your project history—all in one place.<br><a href='https://docs.phcode.dev/docs/Features/git'>Learn more about the Git panel →</a>",
15341535

0 commit comments

Comments
 (0)