mirror of https://github.com/databricks/cli.git
Fix lost diags across different mutators (#2057)
## Changes Fix cases where accumulated diagnostics are lost instead of being propagated further. In some cases it's not possible, add a comment there. ## Tests Existing tests
This commit is contained in:
parent
511db52bb7
commit
3f523b45cc
|
@ -97,7 +97,7 @@ func (m *expandGlobs) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnost
|
|||
return dyn.SetByPath(v, base, dyn.V(output))
|
||||
})
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
diags = diags.Extend(diag.FromErr(err))
|
||||
}
|
||||
|
||||
return diags
|
||||
|
|
|
@ -40,6 +40,7 @@ func (m *resolveResourceReferences) Apply(ctx context.Context, b *bundle.Bundle)
|
|||
})
|
||||
}
|
||||
|
||||
// Note, diags are lost from all goroutines except the first one to return diag
|
||||
return diag.FromErr(errs.Wait())
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,8 @@ func LoadFromBytes(path string, raw []byte) (*Root, diag.Diagnostics) {
|
|||
// Convert normalized configuration tree to typed configuration.
|
||||
err = r.updateWithDynamicValue(v)
|
||||
if err != nil {
|
||||
return nil, diag.Errorf("failed to load %s: %v", path, err)
|
||||
diags = diags.Extend(diag.Errorf("failed to load %s: %v", path, err))
|
||||
return nil, diags
|
||||
}
|
||||
return &r, diags
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@ func (f *folderPermissions) Apply(ctx context.Context, b bundle.ReadOnlyBundle)
|
|||
}
|
||||
|
||||
if err := g.Wait(); err != nil {
|
||||
return diag.FromErr(err)
|
||||
// Note, only diag from first coroutine is captured, others are lost
|
||||
diags = diags.Extend(diag.FromErr(err))
|
||||
}
|
||||
|
||||
for _, r := range results {
|
||||
|
|
Loading…
Reference in New Issue