add some failures

This commit is contained in:
Stephen McQuay 2018-01-26 18:04:38 -08:00
parent c0406348f6
commit cf10974419
Signed by: sm
GPG Key ID: 4E4B72F479BA3CE5
1 changed files with 7 additions and 0 deletions

7
hwt.go
View File

@ -29,6 +29,13 @@ func (s *Server) Hello(ctx context.Context, req *pb.HelloReq) (*pb.HelloResp, er
time.Sleep(rest)
}
switch rand.Int() % 100 {
case 0:
return nil, twirp.NewError(twirp.Internal, "bleeding")
case 1:
return nil, twirp.NewError(twirp.ResourceExhausted, "some exhaustion")
}
r := &pb.HelloResp{
Text: fmt.Sprintf("%s said: %v", u, req.Subject),
Hostname: s.Hostname,