@@ -181,28 +181,27 @@ func setMergeTarget(ctx *context.Context, pull *issues_model.PullRequest) {
181
181
182
182
// GetPullDiffStats get Pull Requests diff stats
183
183
func GetPullDiffStats (ctx * context.Context ) {
184
+ // FIXME: this getPullInfo seems to be a duplicate call with other route handlers
184
185
issue , ok := getPullInfo (ctx )
185
186
if ! ok {
186
187
return
187
188
}
188
189
pull := issue .PullRequest
189
190
190
191
mergeBaseCommitID := GetMergedBaseCommitID (ctx , issue )
191
-
192
192
if mergeBaseCommitID == "" {
193
- ctx .NotFound (nil )
194
- return
193
+ return // no merge base, do nothing, do not stop the route handler, see below
195
194
}
196
195
196
+ // do not report 500 server error to end users if error occurs, otherwise a PR missing ref won't be able to view.
197
197
headCommitID , err := ctx .Repo .GitRepo .GetRefCommitID (pull .GetGitRefName ())
198
198
if err != nil {
199
- ctx . ServerError ( " GetRefCommitID" , err )
199
+ log . Error ( "Failed to GetRefCommitID: %v, repo: %v " , err , ctx . Repo . Repository . FullName () )
200
200
return
201
201
}
202
-
203
202
diffShortStat , err := gitdiff .GetDiffShortStat (ctx .Repo .GitRepo , mergeBaseCommitID , headCommitID )
204
203
if err != nil {
205
- ctx . ServerError ( " GetDiffShortStat" , err )
204
+ log . Error ( "Failed to GetDiffShortStat: %v, repo: %v " , err , ctx . Repo . Repository . FullName () )
206
205
return
207
206
}
208
207
0 commit comments