mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-25 08:59:31 -05:00
* Handle the error of a missing blob object * Show error in logs * as per @zeripath * Add missing error check * Add missing error check * Update compare.go * Use formal code * Update compare.go Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
c18d8d6968
commit
438646e0b5
1 changed files with 11 additions and 2 deletions
|
@ -143,6 +143,11 @@ func setCsvCompareContext(ctx *context.Context) {
|
||||||
if err == errTooLarge {
|
if err == errTooLarge {
|
||||||
return CsvDiffResult{nil, err.Error()}
|
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)
|
headReader, headBlobCloser, err := csvReaderFromCommit(&markup.RenderContext{Ctx: ctx, Filename: diffFile.Name}, headCommit)
|
||||||
if headBlobCloser != nil {
|
if headBlobCloser != nil {
|
||||||
defer headBlobCloser.Close()
|
defer headBlobCloser.Close()
|
||||||
|
@ -150,13 +155,17 @@ func setCsvCompareContext(ctx *context.Context) {
|
||||||
if err == errTooLarge {
|
if err == errTooLarge {
|
||||||
return CsvDiffResult{nil, err.Error()}
|
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)
|
sections, err := gitdiff.CreateCsvDiff(diffFile, baseReader, headReader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
errMessage, err := csv_module.FormatError(err, ctx.Locale)
|
errMessage, err := csv_module.FormatError(err, ctx.Locale)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("RenderCsvDiff failed: %v", err)
|
log.Error("CreateCsvDiff FormatError failed: %v", err)
|
||||||
return CsvDiffResult{nil, ""}
|
return CsvDiffResult{nil, "unknown csv diff error"}
|
||||||
}
|
}
|
||||||
return CsvDiffResult{nil, errMessage}
|
return CsvDiffResult{nil, errMessage}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue