From 337bcf823575e0f945a767d95ea4d57c140e2f7e Mon Sep 17 00:00:00 2001 From: Wilson de Carvalho <796900+wcmjunior@users.noreply.github.com> Date: Mon, 8 Apr 2024 18:31:38 -0700 Subject: [PATCH] Ignore regex analysis for 404 status code --- cyral/core/error_handlers.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cyral/core/error_handlers.go b/cyral/core/error_handlers.go index acb373cd..1e2530e2 100644 --- a/cyral/core/error_handlers.go +++ b/cyral/core/error_handlers.go @@ -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(),