Skip to content

Commit

Permalink
chore: reveiwed uncaught exception handlers in git
Browse files Browse the repository at this point in the history
  • Loading branch information
abose committed Jan 25, 2025
1 parent 6e895b4 commit eb76155
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
33 changes: 25 additions & 8 deletions src/extensions/default/Git/src/Panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ define(function (require, exports) {
}

p.catch(function (err) {
ErrorHandler.showError(err, "Preparing commit dialog failed");
ErrorHandler.showError(err, Strings.ERROR_PREPARING_COMMIT_DIALOG);
}).finally(function () {
Utils.unsetLoading($gitPanel.find(".git-commit"));
});
Expand Down Expand Up @@ -956,7 +956,12 @@ define(function (require, exports) {
return Git.resetIndex();
})
.then(function () {
return handleGitCommit(lastCommitMessage[ProjectManager.getProjectRoot().fullPath], false, COMMIT_MODE.CURRENT);
return handleGitCommit(lastCommitMessage[ProjectManager.getProjectRoot().fullPath],
false, COMMIT_MODE.CURRENT);
}).catch((err)=>{
console.error(err);
// rethrowing with stripped git error details as it may have sensitive info
throw new Error("Error commitCurrentFile in git panel.js. this should not have happened here.");
});
}

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

Expand Down Expand Up @@ -1232,13 +1242,20 @@ define(function (require, exports) {
.on("click", ".check-all", function () {
if ($(this).is(":checked")) {
return Git.stageAll().then(function () {
Git.status();
});
} else {
return Git.resetIndex().then(function () {
Git.status();
return Git.status();
}).catch((err)=>{
console.error(err);
// rethrowing with stripped git error details as it may have sensitive info
throw new Error("Error stage all by checkbox in git panel.js. this should not have happened");
});
}
return Git.resetIndex().then(function () {
return Git.status();
}).catch((err)=>{
console.error(err);
// rethrowing with stripped git error details as it may have sensitive info
throw new Error("Error unstage all by checkbox in git panel.js. this should not have happened");
});
})
.on("click", ".git-refresh", EventEmitter.getEmitter(Events.REFRESH_ALL, ["panel", "refreshBtn"]))
.on("click", ".git-commit", EventEmitter.getEmitter(Events.HANDLE_GIT_COMMIT))
Expand Down
1 change: 1 addition & 0 deletions src/nls/root/strings.js
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,7 @@ define({
"ERROR_NO_REMOTE_SELECTED": "No remote has been selected for {0}!",
"ERROR_BRANCH_LIST": "Getting branch list failed",
"ERROR_FETCH_REMOTE": "Fetching remote information failed",
"ERROR_PREPARING_COMMIT_DIALOG": "Preparing commit dialog failed",
"GIT_TOAST_TITLE": "Explore Git Features in Phoenix Code",
"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>",

Expand Down

0 comments on commit eb76155

Please sign in to comment.