fix using promise

This commit is contained in:
Jonathan Rainville 2018-07-30 13:38:12 -04:00
parent 67b3dff1ba
commit 8724c46924
1 changed files with 3 additions and 6 deletions

View File

@ -126,15 +126,12 @@ class ENS {
}); });
}, },
function setContent(resolver, defaultAccount, next) { function setContent(resolver, defaultAccount, next) {
resolver.methods.setContent(hashedName, contentHash).send({from: defaultAccount}).then((err, transaction) => { resolver.methods.setContent(hashedName, contentHash).send({from: defaultAccount}).then((transaction) => {
if (err) {
return next(err);
}
if (transaction.status !== "0x1" && transaction.status !== "0x01" && transaction.status !== true) { if (transaction.status !== "0x1" && transaction.status !== "0x01" && transaction.status !== true) {
return next('Association failed. Status: ' + transaction.status); return next(new Error('Association failed. Status: ' + transaction.status));
} }
next(); next();
}); }).catch(next);
} }
], cb); ], cb);
} }