refactor profile caller

This commit is contained in:
Iuri Matias 2018-08-01 15:09:16 -04:00 committed by Pascal Precht
parent 1b96fbf451
commit f7d5bd0e70
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
1 changed files with 6 additions and 10 deletions

View File

@ -16,7 +16,7 @@ class Profiler {
profile(contractName, contract, callback) {
const self = this;
this.profileJSON(contractName, contract, (err, profileObj) => {
this.profileJSON(contractName, (err, profileObj) => {
if (err) {
return callback(null, "error found in method: " + name + " error: " + JSON.stringify(err));
}
@ -70,16 +70,12 @@ class Profiler {
'/embark-api/profiler/:contractName',
(req, res) => {
let contractName = req.params.contractName;
self.events.request('contracts:contract', contractName, (contract) => {
if (!contract || !contract.deployedAddress) {
return res.send({error: "-- couldn't profile " + contractName + " - it's not deployed or could be an interface"});
self.profileJSON(contractName, (err, table) => {
if (err) {
return res.send({error: err});
}
self.profile(contractName, contract, (err, table) => {
if (err) {
return res.send({error: err});
}
res.send(table);
});
res.send(table);
});
}
);