Use same error format in toast and wallet log
This commit is contained in:
parent
9228328d3b
commit
377ac04c85
|
@ -452,8 +452,7 @@ export default {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// LND errors are in this shape: [code, type, { err: { code, details, metadata } }]
|
// LND errors are in this shape: [code, type, { err: { code, details, metadata } }]
|
||||||
const details = err[2]?.err?.details || err.message || err.toString?.()
|
const details = err[2]?.err?.details || err.message || err.toString?.()
|
||||||
await addWalletLog({ wallet, level: 'ERROR', message: `could not connect to LND: ${details}` }, { me, models })
|
throw new Error(details)
|
||||||
throw err
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -620,8 +619,9 @@ async function upsertWallet (
|
||||||
await testConnect(data)
|
await testConnect(data)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
await addWalletLog({ wallet, level: 'ERROR', message: 'failed to attach wallet' }, { me, models })
|
const message = err.message || err.toString?.()
|
||||||
throw new GraphQLError('failed to connect to wallet', { extensions: { code: 'BAD_INPUT' } })
|
await addWalletLog({ wallet, level: 'ERROR', message: 'failed to attach: ' + message }, { me, models })
|
||||||
|
throw new GraphQLError(message, { extensions: { code: 'BAD_INPUT' } })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@ export function useWallet (name) {
|
||||||
logger.ok('wallet attached')
|
logger.ok('wallet attached')
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const message = err.message || err.toString?.()
|
const message = err.message || err.toString?.()
|
||||||
logger.error(message)
|
logger.error('failed to attach: ' + message)
|
||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
}, [saveConfig, me, logger])
|
}, [saveConfig, me, logger])
|
||||||
|
|
Loading…
Reference in New Issue