Skip to content

Commit eeca89e

Browse files
Dinesh SalunkeDinesh Salunke
authored andcommitted
refactor: handle errors when converting to APIProject
1 parent d067b1d commit eeca89e

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

services/convert/project.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ func ToAPIProject(ctx context.Context, project *project_model.Project) (*api.Pro
2121
Closed: project.ClosedDateUnix.AsTime(),
2222
}
2323

24-
_ = project.LoadRepo(ctx)
24+
if err := project.LoadRepo(ctx); err != nil {
25+
return nil, err
26+
}
2527
if project.Repo != nil {
2628
apiProject.Repo = &api.RepositoryMeta{
2729
ID: project.RepoID,
@@ -31,7 +33,9 @@ func ToAPIProject(ctx context.Context, project *project_model.Project) (*api.Pro
3133
}
3234
}
3335

34-
_ = project.LoadCreator(ctx)
36+
if err := project.LoadCreator(ctx); err != nil {
37+
return nil, err
38+
}
3539
if project.Creator != nil {
3640
apiProject.Creator = &api.User{
3741
ID: project.Creator.ID,
@@ -40,7 +44,9 @@ func ToAPIProject(ctx context.Context, project *project_model.Project) (*api.Pro
4044
}
4145
}
4246

43-
_ = project.LoadOwner(ctx)
47+
if err := project.LoadOwner(ctx); err != nil {
48+
return nil, err
49+
}
4450
if project.Owner != nil {
4551
apiProject.Owner = &api.User{
4652
ID: project.Owner.ID,

0 commit comments

Comments
 (0)