Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Add Exception to CommandError for the better error message. #78

Merged

Conversation

dzmitryhil
Copy link
Contributor

It was found in the responses from the testnet that the response contains an additional attribute with the detailed error.

The PR contains changes for the error message improvements.

You can try that code snippet (with updated code):

func main() {
	host := "wss://s.altnet.rippletest.net:51233/"
	remote, err := websockets.NewRemote(host)
	panicIfErr(err)
	amount, err := data.NewAmount("100000") // 0.1 XRP tokens
	tx := data.Payment{
		Amount: *amount,
		TxBase: data.TxBase{
			TransactionType: data.PAYMENT,
		},
	}
	// submit the transaction
	_, err = remote.Submit(&tx)
	fmt.Printf("%s\n", err)
}

func panicIfErr(err error) {
	if err != nil {
		panic(err)
	}
}

The output:

invalidTransaction 0  gFID: uncommon type out of range 0

Raw response.

{"error":"invalidTransaction","error_exception":"gFID: uncommon type out of range 0","id":1,"request":{"command":"submit","id":1,"tx_blob":"12000024000000006140000000000186A06880000000000000008114000000000000000000000000000000000000000083140000000000000000000000000000000000000000"},"status":"error","type":"response"}

The output if you run it from the master:

invalidTransaction 0 

@donovanhide donovanhide merged commit e1d40cf into rubblelabs:master Sep 6, 2023
2 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants