//Error: Given parameter is not bytes: "0xue"
//let a = true

    from: result[0],
    gas: 4700000,
}).then((result) => {
.catch((error) => {

my web3 version is 1.0.0.beta.35

  • looks like you have an extra } after console.log(result). Please share these: your contract method functionName signature ( it's from your contract, right? ) , and exact send argument values, i.e. what's in result[0] – Utgarda Sep 26 '18 at 12:59
  • result[0] will be the account address. here functionName(a) should get bytes32 values as input. If it gets other than bytes32 web3 is throwing the error Given parameter is not bytes. I am not able to capture the following error in the catch – MallRoy Sep 26 '18 at 13:26

The way you're catching now is lets you catch exceptions from async calls, i.e. when .send({from...}) returns you a promise. But if functionName gets a wrong parameter, the remote call doesn't even start, so you need to catch it differently.

Try this:

try {
        from: ...
    }).then((result) => {
} catch(err) {
   //process the argument-related error here
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.