You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/utils.ts
+8-6Lines changed: 8 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -48,11 +48,12 @@ export async function getCommitMessage(
48
48
},(err,stdout,stderr)=>{
49
49
channel.appendLine(`STDOUT: ${stdout}`);
50
50
channel.appendLine(`STDERR: ${stderr}`);
51
-
channel.show();
52
51
try{unlinkSync(tmpDiffFile);}catch(e){}
53
-
if(err){
54
-
try{unlinkSync(tmpMsgFile);}catch(e){}
55
-
reject(err);
52
+
53
+
if(/:notfound\s*$/.test(stderr)){
54
+
reject('gptcommit not found, see https://github.com/zurawiki/gptcommit. If it is not in your PATH, set "gptcommit.gptcommitPath" in your settings to the path to gptcommit');
55
+
}elseif(/OpenAIAPIkeynotfound/.test(stderr)){
56
+
reject('OpenAI API key not found, run "gptcommit.setupOpenAIApiKey" command to set it up');
56
57
}elseif(/isbeingamended/.test(stdout)){
57
58
// set allow-amend to true
58
59
constcmd=`${gptcommit} config set allow_amend true`;
@@ -64,8 +65,9 @@ export async function getCommitMessage(
64
65
}).catch((err)=>{
65
66
reject(err);
66
67
});
67
-
}elseif(/OpenAIAPIkeynotfound/.test(stdout)){
68
-
reject('OpenAI API key not found, run "gptcommit.setupOpenAIApiKey" command to set it up');
0 commit comments