chore(sample-docs): unify error handling with panic(err).

This commit is contained in:
banasa44
2025-08-25 12:44:07 +02:00
parent 162a97887e
commit 31be92a37c
41 changed files with 402 additions and 809 deletions

View File

@@ -16,14 +16,12 @@ import (
func main() {
w, err := wallet.FromSeed("sEdSMVV4dJ1JbdBxmakRR4Puu3XVZz2", "")
if err != nil {
fmt.Println(err)
return
panic(err)
}
receiverWallet, err := wallet.FromSeed("sEd7d8Ci9nevdLCeUMctF3uGXp9WQqJ", "")
if err != nil {
fmt.Println(err)
return
panic(err)
}
cfg, err := rpc.NewClientConfig(
@@ -42,8 +40,7 @@ func main() {
fmt.Println("Funding wallet...")
err = client.FundWallet(&w)
if err != nil {
fmt.Println(err)
return
panic(err)
}
fmt.Println("Wallet funded")
}
@@ -54,14 +51,12 @@ func main() {
amount, err := currency.XrpToDrops("1")
if err != nil {
fmt.Println(err)
return
panic(err)
}
amountUint, err := strconv.ParseUint(amount, 10, 64)
if err != nil {
fmt.Println(err)
return
panic(err)
}
fmt.Println("Sending payment...")
@@ -93,20 +88,17 @@ func main() {
err = client.Autofill(&flatTx)
if err != nil {
fmt.Println(err)
return
panic(err)
}
txBlob, _, err := w.Sign(flatTx)
if err != nil {
fmt.Println(err)
return
panic(err)
}
response, err := client.SubmitTxBlobAndWait(txBlob, true)
if err != nil {
fmt.Println(err)
return
panic(err)
}
fmt.Println("Payment submitted")