Skip to content

Commit

Permalink
handle 500 errors which should be 404s
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismarget-j committed Jul 26, 2023
1 parent 04d1df7 commit 4f4885d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions apstra/talk_to_apstra.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ func convertTtaeToAceWherePossible(err error) error {
case strings.Contains(ttae.Msg, "Transformation cannot be changed"):
return ApstraClientErr{errType: ErrCannotChangeTransform, err: errors.New(ttae.Msg)}
}
case http.StatusInternalServerError:
switch {
case strings.Contains(ttae.Msg, "Error executing facade API GET /obj-policy-export") &&
strings.Contains(ttae.Msg, "'NoneType' object has no attribute 'id'"):
return ApstraClientErr{errType: ErrNotfound, err: errors.New(ttae.Msg)}
}
}
}
return err
Expand Down

0 comments on commit 4f4885d

Please sign in to comment.