src/utils/index.js
function errorEnhancement(inputMessage) {
  var message = inputMessage; // eslint-disable-line
  var outputMessage = null; // eslint-disable-line

  // if the input message is an array or object
  if (inputMessage !== null
    && !isNaN(inputMessage)
    && typeof inputMessage !== 'string') {
    message = JSON.stringify(inputMessage);
  }

  // gauentee string convertion, null and other..
  message = String(message);

  // if message includes
  if (message.includes('Compiled contract not found')) {
    outputMessage = 'This could be due to a contract with the same name being compiled. Wafr doesnt allow two contracts with the same name. Look to see if any of your contracts have the same name.';
  }

  // if message includes
  if (message.includes('invalid JUMP')) {
    outputMessage = `This can be caused by many things. One main cause is a 'throw' flag being used somewhere in execution.

    This can be caused by:

    1. A 'throw' flag being used somewhere in execution (a function your calling)
    2. Sending ether to a contract which does not have the 'payable' modifier on the fallback:
        function () payable {}
    3. A send or transaction was out of gas
    `;
  }

  // if message includes
  if (message.includes('invalid opcode') || message.includes('invalid op code')) {
    outputMessage = 'This can be caused by a contract which compiles fine, but doesnt execute properly in the Ethereum Virtual Machine. Such as using a `0x0` as an address.';
  }

  // if message includes
  if (message.includes('out of gas')) {
    outputMessage = `This error can be due to various scenarios:

    1. A error caused somewhere in your contract
    2. An error with the EVM module (npm: 'ethereumjs-vm')
    3. An error caused by the wafr module
    4. An error with the node simulation module (npm: 'ethereumjs-testrpc')
    5. A wafr account actually being out of gas
    6. The 'payable' flag not being used on a contract your sending ether too (common)

    If you cannot resolve this issue with reasonable investigation,
    report the error at:

    http://github.com/SilentCicero/wafr/issues

    If you believe the error is caused by the test node infrastructure,
    report the error at:

    http://github.com/ethereumjs/testrpc

    If you believe the error is caused by the EVM module, report the error
    at:

    http://github.com/ethereumjs/ethereumjs-vm
    `;
  }

  // return output message
  return outputMessage;
}
function errorEnhancement(inputMessage) {
  var message = inputMessage; // eslint-disable-line
  var outputMessage = null; // eslint-disable-line

  // if the input message is an array or object
  if (inputMessage !== null
    && !isNaN(inputMessage)
    && typeof inputMessage !== 'string') {
    message = JSON.stringify(inputMessage);
  }

  // gauentee string convertion, null and other..
  message = String(message);

  // if message includes
  if (message.includes('Compiled contract not found')) {
    outputMessage = 'This could be due to a contract with the same name being compiled. Wafr doesnt allow two contracts with the same name. Look to see if any of your contracts have the same name.';
  }

  // if message includes
  if (message.includes('invalid JUMP')) {
    outputMessage = `This can be caused by many things. One main cause is a 'throw' flag being used somewhere in execution.

    This can be caused by:

    1. A 'throw' flag being used somewhere in execution (a function your calling)
    2. Sending ether to a contract which does not have the 'payable' modifier on the fallback:
        function () payable {}
    3. A send or transaction was out of gas
    `;
  }

  // if message includes
  if (message.includes('invalid opcode') || message.includes('invalid op code')) {
    outputMessage = 'This can be caused by a contract which compiles fine, but doesnt execute properly in the Ethereum Virtual Machine. Such as using a `0x0` as an address.';
  }

  // if message includes
  if (message.includes('out of gas')) {
    outputMessage = `This error can be due to various scenarios:

    1. A error caused somewhere in your contract
    2. An error with the EVM module (npm: 'ethereumjs-vm')
    3. An error caused by the wafr module
    4. An error with the node simulation module (npm: 'ethereumjs-testrpc')
    5. A wafr account actually being out of gas
    6. The 'payable' flag not being used on a contract your sending ether too (common)

    If you cannot resolve this issue with reasonable investigation,
    report the error at:

    http://github.com/SilentCicero/wafr/issues

    If you believe the error is caused by the test node infrastructure,
    report the error at:

    http://github.com/ethereumjs/testrpc

    If you believe the error is caused by the EVM module, report the error
    at:

    http://github.com/ethereumjs/ethereumjs-vm
    `;
  }

  // return output message
  return outputMessage;
}
function errorEnhancement ( inputMessage ) { var message = inputMessage ; // eslint-disable-line var outputMessage = null ; // eslint-disable-line // if the input message is an array or object if ( inputMessage !== null && ! isNaN ( inputMessage ) && typeof inputMessage !== 'string' ) { message = JSON . stringify ( inputMessage ) ; } // gauentee string convertion, null and other.. message = String ( message ) ; // if message includes if ( message . includes ( 'Compiled contract not found' ) ) { outputMessage = 'This could be due to a contract with the same name being compiled. Wafr doesnt allow two contracts with the same name. Look to see if any of your contracts have the same name.' ; } // if message includes if ( message . includes ( 'invalid JUMP' ) ) { outputMessage = ` ` ; } // if message includes if ( message . includes ( 'invalid opcode' ) || message . includes ( 'invalid op code' ) ) { outputMessage = 'This can be caused by a contract which compiles fine, but doesnt execute properly in the Ethereum Virtual Machine. Such as using a `0x0` as an address.' ; } // if message includes if ( message . includes ( 'out of gas' ) ) { outputMessage = ` ` ; } // return output message return outputMessage ; }
error enhancement, more information about bad errors
error enhancement more information about bad errors