Handle errors in contributor list script #109

Merged
raucao merged 1 commits from dev/list_contributors_error_handling into master 2019-04-19 11:22:39 +00:00
Showing only changes of commit 1d771c43e8 - Show all commits

View File

@@ -15,12 +15,16 @@ module.exports = async function(callback) {
console.log(`Using Contributor at: ${kredits.Contributor.contract.address}`);
const table = new Table({
head: ['ID', 'Account', 'Name', 'Core?', 'Balance', 'IPFS']
})
let contributors = await kredits.Contributor.all()
try {
const contributors = await kredits.Contributor.all()
} catch(e) {
callback(e);
return;
}
contributors.forEach((c) => {
table.push([
@@ -32,7 +36,9 @@ module.exports = async function(callback) {
c.ipfsHash
])
})
console.log(table.toString())
callback()
}