From 1fefa4f7fffa8c515e9d230455dca3c32040646a Mon Sep 17 00:00:00 2001 From: Ron <38083777+roneli@users.noreply.github.com> Date: Thu, 16 Jun 2022 15:52:45 +0300 Subject: [PATCH] fix: Classify db execution errors --- provider/execution/execution.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/provider/execution/execution.go b/provider/execution/execution.go index 318e5155..2aa08bfb 100644 --- a/provider/execution/execution.go +++ b/provider/execution/execution.go @@ -275,7 +275,7 @@ func (e TableExecutor) callTableResolve(ctx context.Context, client schema.Clien } if err := e.cleanupStaleData(ctx, client, parent); err != nil { - return nc, diags.Add(fromError(err, diag.WithType(diag.DATABASE), diag.WithSummary("failed to cleanup stale data on table %q", e.Table.Name))) + return nc, diags.Add(ClassifyError(err, diag.WithType(diag.DATABASE), diag.WithSummary("failed to cleanup stale data on table %q", e.Table.Name))) } return nc, diags @@ -340,7 +340,7 @@ func (e TableExecutor) saveToStorage(ctx context.Context, resources schema.Resou } e.Logger.Error("failed insert to db", "error", err) // Setup diags, adding first diagnostic that bulk insert failed - diags := diag.Diagnostics{}.Add(fromError(err, diag.WithType(diag.DATABASE), diag.WithSummary("failed bulk insert on table %q", e.Table.Name))) + diags := diag.Diagnostics{}.Add(ClassifyError(err, diag.WithType(diag.DATABASE), diag.WithSummary("failed bulk insert on table %q", e.Table.Name))) // Try to insert resource by resource if partial fetch is enabled and an error occurred partialFetchResources := make(schema.Resources, 0) for id := range resources {