mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-30 19:15:23 +01:00 
			
		
		
		
	Fix ignored errors in API route (#2850)
* Fix ignored errors in API route
This commit is contained in:
		
							parent
							
								
									57de1ff991
								
							
						
					
					
						commit
						d91fe5254d
					
				| @ -26,10 +26,6 @@ func ListPullRequests(ctx *context.APIContext, form api.ListPullRequestsOptions) | |||||||
| 		MilestoneID: ctx.QueryInt64("milestone"), | 		MilestoneID: ctx.QueryInt64("milestone"), | ||||||
| 	}) | 	}) | ||||||
| 
 | 
 | ||||||
| 	/*prs, maxResults, err := models.PullRequests(ctx.Repo.Repository.ID, &models.PullRequestsOptions{ |  | ||||||
| 		Page:  form.Page, |  | ||||||
| 		State: form.State, |  | ||||||
| 	})*/ |  | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		ctx.Error(500, "PullRequests", err) | 		ctx.Error(500, "PullRequests", err) | ||||||
| 		return | 		return | ||||||
| @ -37,10 +33,22 @@ func ListPullRequests(ctx *context.APIContext, form api.ListPullRequestsOptions) | |||||||
| 
 | 
 | ||||||
| 	apiPrs := make([]*api.PullRequest, len(prs)) | 	apiPrs := make([]*api.PullRequest, len(prs)) | ||||||
| 	for i := range prs { | 	for i := range prs { | ||||||
| 		prs[i].LoadIssue() | 		if err = prs[i].LoadIssue(); err != nil { | ||||||
| 		prs[i].LoadAttributes() | 			ctx.Error(500, "LoadIssue", err) | ||||||
| 		prs[i].GetBaseRepo() | 			return | ||||||
| 		prs[i].GetHeadRepo() | 		} | ||||||
|  | 		if err = prs[i].LoadAttributes(); err != nil { | ||||||
|  | 			ctx.Error(500, "LoadAttributes", err) | ||||||
|  | 			return | ||||||
|  | 		} | ||||||
|  | 		if err = prs[i].GetBaseRepo(); err != nil { | ||||||
|  | 			ctx.Error(500, "GetBaseRepo", err) | ||||||
|  | 			return | ||||||
|  | 		} | ||||||
|  | 		if err = prs[i].GetHeadRepo(); err != nil { | ||||||
|  | 			ctx.Error(500, "GetHeadRepo", err) | ||||||
|  | 			return | ||||||
|  | 		} | ||||||
| 		apiPrs[i] = prs[i].APIFormat() | 		apiPrs[i] = prs[i].APIFormat() | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| @ -60,8 +68,14 @@ func GetPullRequest(ctx *context.APIContext) { | |||||||
| 		return | 		return | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	pr.GetBaseRepo() | 	if err = pr.GetBaseRepo(); err != nil { | ||||||
| 	pr.GetHeadRepo() | 		ctx.Error(500, "GetBaseRepo", err) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
|  | 	if err = pr.GetHeadRepo(); err != nil { | ||||||
|  | 		ctx.Error(500, "GetHeadRepo", err) | ||||||
|  | 		return | ||||||
|  | 	} | ||||||
| 	ctx.JSON(200, pr.APIFormat()) | 	ctx.JSON(200, pr.APIFormat()) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user