You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(feature): improve error message and logs when variation change error occurs
Deleting a variation that is still referenced returned a generic error that
did not explain the cause. References inside the flag surfaced as
"InvalidArgumentNotMatchFormatError" with field "variation", and references
from other flags surfaced as a bare "FailedPreconditionError". Neither
carried the variation or the flag holding the reference, and no server-side
log was written at all.
Split the single ErrVariationInUse sentinel into six errors, one per cause,
each with its own message key so the console can explain what to fix:
- VariationInUseByOffVariationError
- VariationInUseByDefaultStrategyError
- VariationInUseByTargetingRuleError
- VariationInUseByIndividualTargetingError
- VariationInUseByPrerequisiteError
- VariationInUseByFeatureFlagRuleError
The cross-flag errors embed the referencing flag id and name so the console
can name it, and their message spells out the whole relationship for the
logs ("variation X of feature A is used as a prerequisite by feature B").
Also add logVariationInUseError so the rejected update is recorded with the
environment, the flag, the variations being deleted and the reference.
Validation failures were previously not logged anywhere.
Note that the gRPC code for same-flag references changes from
InvalidArgument to FailedPrecondition, matching the code already used for
cross-flag references.
Closes#1794
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0 commit comments