Skip to content

Commit

Permalink
Ignore regex analysis for 404 status code
Browse files Browse the repository at this point in the history
  • Loading branch information
wcmjunior committed Apr 9, 2024
1 parent 386a9dc commit 337bcf8
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cyral/core/error_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ func (h *IgnoreNotFoundByMessage) HandleError(
) error {
tflog.Debug(ctx, "==> Init HandleError core.IgnoreNotFoundByMessage")

// If this is a 404 already, then we don't need to actually match the error message
httpError, _ := err.(*client.HttpError)
if httpError.StatusCode == http.StatusNotFound {
tflog.Debug(ctx, "===> Ignoring regex matching as the status code is already 404")
r.SetId("")
return nil
}

matched, regexpError := regexp.MatchString(
h.MessageMatches,
err.Error(),
Expand Down

0 comments on commit 337bcf8

Please sign in to comment.