Merge pull request #4691 from joostjager/sendtoroute-status-code

routerrpc: map errors to grpc status code
This commit is contained in:
Olaoluwa Osuntokun
2020-11-11 19:51:45 -08:00
committed by GitHub

View File

@@ -368,6 +368,13 @@ func (s *Server) SendToRouteV2(ctx context.Context,
return rpcAttempt, nil
}
// Transform user errors to grpc code.
if err == channeldb.ErrPaymentInFlight ||
err == channeldb.ErrAlreadyPaid {
return nil, status.Error(codes.AlreadyExists, err.Error())
}
return nil, err
}