Explorar el Código

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

main
Eric Amodio hace 7 años
padre
commit
6c536e9360
Se han modificado 1 ficheros con 9 adiciones y 2 borrados
  1. +9
    -2
      src/blameStatusBarController.ts

+ 9
- 2
src/blameStatusBarController.ts Ver fichero

@ -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);

Cargando…
Cancelar
Guardar