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
commit c2bba7ed71
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -368,6 +368,13 @@ func (s *Server) SendToRouteV2(ctx context.Context,
return rpcAttempt, nil 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 return nil, err
} }