Add more error messages

This commit is contained in:
Jonas Franz 2018-07-09 13:58:08 +02:00
parent 858345df01
commit 3f39e23ebf
No known key found for this signature in database
GPG Key ID: 506AEEBE80BEDECD

View File

@ -779,17 +779,17 @@ func CreateCodeComment(doer *User, repo *Repository, issue *Issue, content, tree
// Get latest commit referencing the commented line
commit, err := gitRepo.LineBlame(pr.HeadBranch, gitRepo.Path, treePath, uint(gitLine))
if err != nil {
return nil, err
return nil, fmt.Errorf("LineBlame[%s, %s, %s, %d]: %v", pr.HeadBranch, gitRepo.Path, treePath, gitLine, err)
}
// Only fetch diff if comment is review comment
if reviewID != 0 {
headCommitID, err := gitRepo.GetRefCommitID(pr.GetGitRefName())
if err != nil {
return nil, err
return nil, fmt.Errorf("GetRefCommitID[%s]: %v", pr.GetGitRefName(), err)
}
patchBuf := new(bytes.Buffer)
if err := GetRawDiffForFile(gitRepo.Path, pr.MergeBase, headCommitID, RawDiffNormal, treePath, patchBuf); err != nil {
return nil, err
return nil, fmt.Errorf("GetRawDiffForLine[%s, %s, %s, %s]: %v", err, gitRepo.Path, pr.MergeBase, headCommitID, treePath)
}
patch = CutDiffAroundLine(strings.NewReader(patchBuf.String()), int64((&Comment{Line: line}).UnsignedLine()), line < 0, setting.UI.CodeCommentLines)
commitID = commit.ID.String()