Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(clouderror)!: preserve grpc error code if present
This feature ensures that the original gRPC error code is preserved when an error is wrapped, rather than being automatically promoted to a generic `Internal` error. *Problem* When a downstream function throws a gRPC error, and the callee wraps that error (as shown in the code snippet), the original error code (e.g., `InvalidArgument`) is replaced with a `Internal` error. ```go func Handle() (any, error){ resp, err := Service() if err != nil { return nil, cloudrunner.WrapTransient(err, "service error") } return resp, nil } func Service() (any, error){ return nil, status.Error(codes.InvalidArgument, codes.InvalidArgument.String()) } ``` TRA-1791
- Loading branch information