Merge pull request #10064 from ellemouton/getChanInfoGrpcErr
rpcserver: return consistent grpc NotFound error for GetChaninfo & LookupInvoice
This commit is contained in:
5 files changed
+128
-2
No files matched your search
+7
-2
@@ -6445,7 +6445,9 @@ func (r *rpcServer) LookupInvoice(ctx context.Context,
|
||||
|
||||
invoice, err := r.server.invoices.LookupInvoice(ctx, payHash)
|
||||
switch {
|
||||
case errors.Is(err, invoices.ErrInvoiceNotFound):
|
||||
case errors.Is(err, invoices.ErrInvoiceNotFound) ||
|
||||
errors.Is(err, invoices.ErrNoInvoicesCreated):
|
||||
|
||||
return nil, status.Error(codes.NotFound, err.Error())
|
||||
case err != nil:
|
||||
return nil, err
|
||||
@@ -6989,7 +6991,10 @@ func (r *rpcServer) GetChanInfo(_ context.Context,
|
||||
default:
|
||||
return nil, fmt.Errorf("specify either chan_id or chan_point")
|
||||
}
|
||||
if err != nil {
|
||||
switch {
|
||||
case errors.Is(err, graphdb.ErrEdgeNotFound):
|
||||
return nil, status.Error(codes.NotFound, err.Error())
|
||||
case err != nil:
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user