Remove redundant logging after every mutator

This commit is contained in:
Denis Bilenko 2025-01-24 12:45:09 +01:00
parent d8dcea79c8
commit c657006530
2 changed files with 2 additions and 17 deletions

View File

@ -35,17 +35,7 @@ func Apply(ctx context.Context, b *Bundle, m Mutator) diag.Diagnostics {
}
}()
diags := m.Apply(ctx, b)
// Log error in diagnostics if any.
// Note: errors should be logged when constructing them
// such that they are not logged multiple times.
// If this is done, we can omit this block.
if err := diags.Error(); err != nil {
log.Errorf(ctx, "Error: %s", err)
}
return diags
return m.Apply(ctx, b)
}
type funcMutator struct {

View File

@ -20,10 +20,5 @@ func ApplyReadOnly(ctx context.Context, rb ReadOnlyBundle, m ReadOnlyMutator) di
ctx = log.NewContext(ctx, log.GetLogger(ctx).With("mutator (read-only)", m.Name()))
log.Debugf(ctx, "ApplyReadOnly")
diags := m.Apply(ctx, rb)
if err := diags.Error(); err != nil {
log.Errorf(ctx, "Error: %s", err)
}
return diags
return m.Apply(ctx, rb)
}