Skip to content

Commit

Permalink
Added error check; removed duplicate error processing
Browse files Browse the repository at this point in the history
  • Loading branch information
reggieriser committed Feb 10, 2021
1 parent c1bd499 commit b6c4cc4
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions pkg/services/move_order/move_order_fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,6 @@ func (f moveOrderFetcher) ListMoveOrders(officeUserID uuid.UUID, params *service
}
}

if err != nil {
switch err {
case sql.ErrNoRows:
return []models.Move{}, 0, services.NotFoundError{}
default:
return []models.Move{}, 0, err
}
}
// Pass zeros into paginate in this case. Which will give us 1 page and 20 per page respectively
if params.Page == nil {
params.Page = swag.Int64(0)
Expand Down Expand Up @@ -127,7 +119,10 @@ func (f moveOrderFetcher) ListMoveOrders(officeUserID uuid.UUID, params *service
// cannot eager load the address as "OriginDutyStation.Address" because
// OriginDutyStation is a pointer.
if moves[i].Orders.OriginDutyStation != nil {
f.db.Load(moves[i].Orders.OriginDutyStation, "TransportationOffice")
loadErr := f.db.Load(moves[i].Orders.OriginDutyStation, "TransportationOffice")
if loadErr != nil {
return []models.Move{}, 0, err
}
}
}

Expand Down

0 comments on commit b6c4cc4

Please sign in to comment.