Skip to content

Commit

Permalink
Merge pull request lightningnetwork#4691 from joostjager/sendtoroute-…
Browse files Browse the repository at this point in the history
…status-code

routerrpc: map errors to grpc status code
  • Loading branch information
Roasbeef authored Nov 12, 2020
2 parents 58f72df + 856abad commit c2bba7e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lnrpc/routerrpc/router_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit c2bba7e

Please sign in to comment.