🐛 fix(vscode): GitHub 工单已被删除(410)时按不存在处理,不再报错

This commit is contained in:
cruldra committed 2026-10-19 08:34:39 +11:00
1 parent 5e62842cfa
commit 2dabbf1200
2 files changed
+7 -2

No files matched your search

+2 -2
View File
@@ -251,14 +251,14 @@ export class GitHubProvider implements ForgeProvider {
return raws.filter(raw => raw.pull_request === undefined).map(toIssue)
}
/** 这个编号是 PR 时也返回 `null`。 */
/** 工单不存在(404)、已被删除(GitHub 回 410)或这个编号其实是 PR 时都返回 `null`。 */
async getIssue(issueNumber: number): Promise<ForgeIssue | null> {
try {
const raw = await this.rawIssue(issueNumber)
return raw.pull_request === undefined ? toIssue(raw) : null
}
catch (err) {
if (err instanceof ForgeApiError && err.status === 404)
if (err instanceof ForgeApiError && (err.status === 404 || err.status === 410))
return null
throw err
}