error handling

This commit is contained in:
callebtc
2022-11-05 20:16:17 +01:00
parent f99dcf407c
commit 56fc273e15

View File

@ -1448,7 +1448,12 @@
try { try {
const spendableProofs = proofs.filter(p => !p.reserved) const spendableProofs = proofs.filter(p => !p.reserved)
if (this.sumProofs(spendableProofs) < amount) { if (this.sumProofs(spendableProofs) < amount) {
throw new Error('balance too low.') this.$q.notify({
timeout: 5000,
type: 'warning',
message: 'Balance too low'
})
throw Error('balance too low.')
} }
let {fristProofs, scndProofs} = await this.split( let {fristProofs, scndProofs} = await this.split(
spendableProofs, spendableProofs,
@ -1591,6 +1596,7 @@
}, },
sendTokens: async function () { sendTokens: async function () {
try {
// keep firstProofs, send scndProofs // keep firstProofs, send scndProofs
let {fristProofs, scndProofs} = await this.splitToSend( let {fristProofs, scndProofs} = await this.splitToSend(
this.proofs, this.proofs,
@ -1609,6 +1615,11 @@
}) })
this.storehistoryTokens() this.storehistoryTokens()
this.checkTokenSpendableWorker() this.checkTokenSpendableWorker()
} catch (error) {
console.error(error)
throw error
}
}, },
checkFees: async function (payment_request) { checkFees: async function (payment_request) {
const payload = { const payload = {
@ -1794,7 +1805,7 @@
if (verbose) { if (verbose) {
this.$q.notify({ this.$q.notify({
timeout: 5000, timeout: 5000,
color: 'gray', color: 'grey',
message: 'Token still pending' message: 'Token still pending'
}) })
} }