mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-02-16 10:58:34 -05:00
Fixes exception trapping
This commit is contained in:
@@ -129,27 +129,28 @@ export default class Git {
|
|||||||
return gitCommand(repoPath, ...params);
|
return gitCommand(repoPath, ...params);
|
||||||
}
|
}
|
||||||
|
|
||||||
static getVersionedFile(fileName: string, repoPath: string, sha: string) {
|
static async getVersionedFile(fileName: string, repoPath: string, sha: string) {
|
||||||
|
const data = await Git.getVersionedFileText(fileName, repoPath, sha);
|
||||||
|
|
||||||
|
const ext = path.extname(fileName);
|
||||||
return new Promise<string>((resolve, reject) => {
|
return new Promise<string>((resolve, reject) => {
|
||||||
Git.getVersionedFileText(fileName, repoPath, sha).then(data => {
|
tmp.file({ prefix: `${path.basename(fileName, ext)}-${sha}__`, postfix: ext },
|
||||||
const ext = path.extname(fileName);
|
(err, destination, fd, cleanupCallback) => {
|
||||||
tmp.file({ prefix: `${path.basename(fileName, ext)}-${sha}__`, postfix: ext },
|
if (err) {
|
||||||
(err, destination, fd, cleanupCallback) => {
|
reject(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger.log(`getVersionedFile(${fileName}, ${repoPath}, ${sha}); destination=${destination}`);
|
||||||
|
fs.appendFile(destination, data, err => {
|
||||||
if (err) {
|
if (err) {
|
||||||
reject(err);
|
reject(err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.log(`getVersionedFile(${fileName}, ${repoPath}, ${sha}); destination=${destination}`);
|
resolve(destination);
|
||||||
fs.appendFile(destination, data, err => {
|
|
||||||
if (err) {
|
|
||||||
reject(err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
resolve(destination);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user