feat(registration) : surface opaque errors from Register method #307
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These error wrappers and constants are probably not fully accurate or comprehensive, but this draft in intended to serve as a discussion of whether or not we can/should handle these directly in the SDK
Background
Some granular errors are surfaced through reg.Id as negative values.
This adds both constants and strongly-typed errors for downstream consumers to handle more easily these opaque error cases.
Motivation
Avoid patterns in downstream consumers of the client SDK like the rancher SCC operator, where we have to redefine these values as well as handle both the (int, error) responses and decide later which is an error case:
https://github.com/mallardduck/rancher/blob/b06c7c90fb76d04e6c715cb66ca1206f5b71c75c/pkg/scc/suseconnect/wrapper.go#L58-L83