fix: 🐛 Improve logging and output and error-handling

main
Keith Irwin 2024-04-21 12:24:00 -06:00
parent 3a76f49a79
commit bf7f011657
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
2 changed files with 9 additions and 7 deletions

14
main.js
View File

@ -37,12 +37,14 @@ module.exports = class Wallet {
method: method,
params: params,
})
if (res.status!==200) throw res.data
} catch (err) {
console.error(err)
}
console.log(res.data)
return res.data
if (res.status!==200)
throw new Error(res.statusText)
if (res.data.error)
throw new Error(res.data.error.message)
if (!res.data.result)
throw new Error('No result sent')
} catch (err) { console.error(err) }
return res.data.result
}
}

View File

@ -1,7 +1,7 @@
{
"name": "monero-wallet-rpc-js",
"type": "commonjs",
"version": "1.1.14",
"version": "1.1.15",
"description": "Javascript wrapper for monero-wallet-rpc calls",
"main": "main.js",
"scripts": {