Fixes exception trapping

This commit is contained in:
Eric Amodio
2017-02-10 04:10:55 -05:00
parent b0fbbc718c
commit 9a8045b6f2

View File

@@ -129,10 +129,11 @@ export default class Git {
return gitCommand(repoPath, ...params);
}
static getVersionedFile(fileName: string, repoPath: string, sha: string) {
return new Promise<string>((resolve, reject) => {
Git.getVersionedFileText(fileName, repoPath, sha).then(data => {
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) => {
tmp.file({ prefix: `${path.basename(fileName, ext)}-${sha}__`, postfix: ext },
(err, destination, fd, cleanupCallback) => {
if (err) {
@@ -146,11 +147,11 @@ export default class Git {
reject(err);
return;
}
resolve(destination);
});
});
});
});
}
static getVersionedFileText(fileName: string, repoPath: string, sha: string) {