-
Notifications
You must be signed in to change notification settings - Fork 15
Fix "error: no errors" #312
Comments
Summary of meeting today:
|
The issue from cloudquery/cloudquery#772 was already fixed. |
Also, the single "Diag" might also not want to support the error interface. looking at the code of our aws and GCP providers, I see only 1 place where we actually return a diagnostic and not an error from a resolver. |
Sub issue (not huge priority): column resolvers don't always mention which resource failed.
I believe that this is because we don't resolve the PKs first... |
Moving to icebox per @yevgenypats request |
Describe the bug
An interesting bug that stems from the fact that
diag.Diagnostics
implements theerror
interface (i.e.func Error() string {
:both
diag.BaseError
anddiag.Diagnostics
(i.e. a slice of diagnostics[]diag.Diagnostics
) implement the error interface:This means that, if a function returns
diag.Diagnostics
, but thinks it returns anerror
, it will be implicitly converted. And thus, even though the function returned nil, the caller will actually seeerror: no errors
.To reproduce:
Output:
Insights:
A customer complained about
error: no errors
in discord a couple of weeks ago (in relation to policies).implicit conversion is bad! The code for converting
Diagnostics
to errors makes me believe that this is a side effect that the writer did not intend.cq-provider-sdk/provider/diag/diagnostics.go
Line 18 in 22a7afb
My proposal would be to rename Diagnostics.Error() to Diagnostics.ToError() to avoid implementing the error interface and allowing this implicit conversion.
Expected Behavior
Steps to Reproduce
Possible Solution
No response
Provider and CloudQuery version
0.24.7
Additional Context
No response
The text was updated successfully, but these errors were encountered: