refactor profile caller
This commit is contained in:
parent
1b96fbf451
commit
f7d5bd0e70
|
@ -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);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue