summaryrefslogtreecommitdiffstats
path: root/routers/web/repo/compare.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/web/repo/compare.go')
-rw-r--r--routers/web/repo/compare.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go
index 7721507bae..d483227ebf 100644
--- a/routers/web/repo/compare.go
+++ b/routers/web/repo/compare.go
@@ -143,6 +143,11 @@ func setCsvCompareContext(ctx *context.Context) {
if err == errTooLarge {
return CsvDiffResult{nil, err.Error()}
}
+ if err != nil {
+ log.Error("CreateCsvDiff error whilst creating baseReader from file %s in commit %s in %s: %v", diffFile.Name, baseCommit.ID.String(), ctx.Repo.Repository.Name, err)
+ return CsvDiffResult{nil, "unable to load file from base commit"}
+ }
+
headReader, headBlobCloser, err := csvReaderFromCommit(&markup.RenderContext{Ctx: ctx, Filename: diffFile.Name}, headCommit)
if headBlobCloser != nil {
defer headBlobCloser.Close()
@@ -150,13 +155,17 @@ func setCsvCompareContext(ctx *context.Context) {
if err == errTooLarge {
return CsvDiffResult{nil, err.Error()}
}
+ if err != nil {
+ log.Error("CreateCsvDiff error whilst creating headReader from file %s in commit %s in %s: %v", diffFile.Name, headCommit.ID.String(), ctx.Repo.Repository.Name, err)
+ return CsvDiffResult{nil, "unable to load file from head commit"}
+ }
sections, err := gitdiff.CreateCsvDiff(diffFile, baseReader, headReader)
if err != nil {
errMessage, err := csv_module.FormatError(err, ctx.Locale)
if err != nil {
- log.Error("RenderCsvDiff failed: %v", err)
- return CsvDiffResult{nil, ""}
+ log.Error("CreateCsvDiff FormatError failed: %v", err)
+ return CsvDiffResult{nil, "unknown csv diff error"}
}
return CsvDiffResult{nil, errMessage}
}