Is your feature request related to a problem? Please describe.
Certain APIs like in my situation the docstore Action() return non-unwrappable error types like ActionListError.
This results in a lot of boilerplate code to achieve something for which go offers an idiomatic approach (errors.As/Is):
if err = coll.Actions().Create(a).Create(b).Create(c).Do(ctx); err != nil {
if aErrs, ok := errors.AsType[docstore.ActionListError](err); ok {
for _, aErr := range aErrs {
if gcerrors.Code(aErr.Err) == gcerrors.AlreadyExists {
return "", nil
}
}
}
return "", err
}
Describe the solution you'd like
Is there a specific reason for the usage of message codes here? Would it be viable to use error structs instead so that the go errors utilities can be used for comparison / unwrapping instead of the gcerrors package?
Describe alternatives you've considered
Writing helper utilities for the boilerplate code shown above.
Additional context
Is your feature request related to a problem? Please describe.
Certain APIs like in my situation the
docstoreAction() return non-unwrappable error types likeActionListError.This results in a lot of boilerplate code to achieve something for which go offers an idiomatic approach (errors.As/Is):
Describe the solution you'd like
Is there a specific reason for the usage of message codes here? Would it be viable to use error structs instead so that the go
errorsutilities can be used for comparison / unwrapping instead of the gcerrors package?Describe alternatives you've considered
Writing helper utilities for the boilerplate code shown above.
Additional context