Skip to content

Commit

Permalink
handle 404 case in `GetRoutingPolicyByName()\'
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismarget-j committed Jul 19, 2023
1 parent 38b1387 commit f1ca7b0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions apstra/two_stage_l3_clos_routing_policies.go
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,13 @@ func (o *TwoStageL3ClosClient) getRoutingPolicyByName(ctx context.Context, desir
policyIdx = i
}

if policyIdx < 0 {
return nil, ApstraClientErr{
errType: ErrNotfound,
err: fmt.Errorf("routing policy with name %q not found", desired),
}
}

return &policies[policyIdx], nil
}

Expand Down

0 comments on commit f1ca7b0

Please sign in to comment.