Browse Source

Adds logging for #22 - Cannot read property 'sha' of undefined

main
Eric Amodio 7 years ago
parent
commit
6c536e9360
1 changed files with 9 additions and 2 deletions
  1. +9
    -2
      src/blameStatusBarController.ts

+ 9
- 2
src/blameStatusBarController.ts View File

@ -4,6 +4,7 @@ import { Disposable, ExtensionContext, StatusBarAlignment, StatusBarItem, TextDo
import { TextDocumentComparer } from './comparers';
import { IConfig, StatusBarCommand } from './configuration';
import GitProvider, { GitCommit, GitUri, IGitBlame } from './gitProvider';
import { Logger } from './logger';
import * as moment from 'moment';
export default class BlameStatusBarController extends Disposable {
@ -108,8 +109,14 @@ export default class BlameStatusBarController extends Disposable {
return;
}
const sha = blame.lines[line].sha;
commit = blame.commits.get(sha);
try {
const sha = blame.lines[line].sha;
commit = blame.commits.get(sha);
}
catch (ex) {
Logger.error(`DEBUG(${this._uri.toString()}): Line ${line} not found in blame; lines=${blame.lines.length}, uriOffset=${this._uri.offset}, repoPath=${blame.repoPath}`);
throw ex;
}
}
else {
const blameLine = await this.git.getBlameForLine(this._uri.fsPath, line, this._uri.sha, this._uri.repoPath);

Loading…
Cancel
Save