mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
multi: surface server swap initiation grpc error codes
Formatting our error was stifling any grpc error returned by the server. Instead, we bubble up our grpc error, setting an unknown code if the server did not specifically return an error code.
This commit is contained in:
parent
e7ee29bd83
commit
d1c26a20da
5 changed files with 59 additions and 8 deletions
|
|
@ -9,11 +9,10 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
|
||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||
"github.com/btcsuite/btcd/mempool"
|
||||
"github.com/btcsuite/btcd/wire"
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightninglabs/lndclient"
|
||||
"github.com/lightninglabs/loop/labels"
|
||||
"github.com/lightninglabs/loop/loopdb"
|
||||
|
|
@ -86,7 +85,7 @@ func newLoopInSwap(globalCtx context.Context, cfg *swapConfig,
|
|||
// request that we send to the server.
|
||||
quote, err := cfg.server.GetLoopInQuote(globalCtx, request.Amount)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("loop in terms: %v", err)
|
||||
return nil, wrapGrpcError("loop in terms", err)
|
||||
}
|
||||
|
||||
swapFee := quote.SwapFee
|
||||
|
|
@ -172,7 +171,7 @@ func newLoopInSwap(globalCtx context.Context, cfg *swapConfig,
|
|||
)
|
||||
probeWaitCancel()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("cannot initiate swap: %v", err)
|
||||
return nil, wrapGrpcError("cannot initiate swap", err)
|
||||
}
|
||||
|
||||
// Because the context is cancelled, it is guaranteed that we will be
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue