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
+21Lines changed: 21 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -56,10 +56,19 @@ export async function getCommitMessage(
56
56
try{unlinkSync(tmpDiffFile);}catch(e){}
57
57
58
58
if(/:notfound\s*$/.test(stderr)){
59
+
if(config.debug){
60
+
channel.appendLine('DEBUG: gptcommit not found');
61
+
}
59
62
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');
60
63
}elseif(/OpenAIAPIkeynotfound/.test(stderr)){
64
+
if(config.debug){
65
+
channel.appendLine('DEBUG: OpenAI API key not set');
66
+
}
61
67
reject('OpenAI API key not found, run "gptcommit.setupOpenAIApiKey" command to set it up');
62
68
}elseif(/isbeingamended/.test(stdout)){
69
+
if(config.debug){
70
+
channel.appendLine('DEBUG: allow_amend is false');
71
+
}
63
72
// set allow-amend to true
64
73
constcmd=`${gptcommit} config set allow_amend true`;
65
74
channel.appendLine(`COMMAND: ${cmd}`);
@@ -71,15 +80,27 @@ export async function getCommitMessage(
71
80
reject(err);
72
81
});
73
82
}elseif(err||stderr){
83
+
if(config.debug){
84
+
channel.appendLine(`DEBUG: gptcommit failed with error: ${err} | ${stderr}`);
85
+
}
74
86
try{unlinkSync(tmpMsgFile);}catch(e){}
75
87
reject(err||stderr);
76
88
}elseif(!existsSync(tmpMsgFile)){
89
+
if(config.debug){
90
+
channel.appendLine('DEBUG: gptcommit failed to generate commit message, message file not generated');
0 commit comments