Skip to content

Commit

Permalink
Change the ratio of grpc demo exception
Browse files Browse the repository at this point in the history
  • Loading branch information
hexiaofeng committed Jan 2, 2025
1 parent 36f1b1d commit 69579e6
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class UserServiceGrpcImpl extends UserServiceGrpc.UserServiceImplBase {

@Override
public void get(UserGetRequest request, StreamObserver<UserGetResponse> responseObserver) {
if (ThreadLocalRandom.current().nextInt(5) == 0) {
if (request.getId() < 0 && ThreadLocalRandom.current().nextInt(5) == 0) {
responseObserver.onError(new RuntimeException("error"));
return;
}
Expand Down

0 comments on commit 69579e6

Please sign in to comment.