Hi guys. I developed a SC with Solidity and I have a script that loads the blockchain with test data and when execute first time, It's ok, but when execute other times I get this message:

VM Exception while processing transaction: revert.

how can capture this error in try - catch and return my custom message for frontend?.

thanks!

this is my code:

try {
await deed.create(_serialNumber1, _manufacturer1, _owner1);
await deed.create(_serialNumber2, _manufacturer2, _owner2);
await deed.create(_serialNumber3, _manufacturer3, _owner3);
await deed.create(_serialNumber4, _manufacturer4, _owner4);
await deed.create(_serialNumber5, _manufacturer5, _owner5);
await deed.create(_serialNumber6, _manufacturer6, _owner6);
await deed.create(_serialNumber7, _manufacturer7, _owner7);
} catch (error) {
console.log("Error");
console.log(error.message);
}

Jul 19, 2019, 3:44 PM

© 2024 Draquery.com All rights reserved.