How to use the @colony/purser-core/utils.objectToErrorString function in @colony/purser-core

To help you get started, we’ve selected a few @colony/purser-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github JoinColony / purser / modules / node_modules / @colony / purser-trezor / index.js View on Github external
*/
    if (caughtError.message === STD_ERRORS.CANCEL_ACC_EXPORT) {
      return warning(messages.userExportCancel);
    }
    /*
     * But throw otherwise, so we can see what's going on
     */
    throw new Error(
      /*
       * @TODO Move message to general
       *
       * Right now this message string is added under the "static methods" category.
       * Since this is used in multiple places, there's a case to be made about
       * making it a "general" category message.
       */
      `${messages.userExportGenericError}: ${objectToErrorString(
        modifiedPayloadObject,
      )} ${caughtError.message}`,
    );
  }
};
github JoinColony / purser / modules / node_modules / @colony / purser-trezor / staticMethods.js View on Github external
return hexSequenceNormalizer(
      unsignedTransaction.serialize().toString(HEX_HASH_TYPE),
    );
  } catch (caughtError) {
    /*
     * If the user cancels signing the transaction we still throw,
     * but we customize the message.
     */
    if (caughtError.message === STD_ERRORS.CANCEL_TX_SIGN) {
      throw new Error(messages.userSignTxCancel);
    }
    /*
     * But throw otherwise, so we can see what's going on
     */
    throw new Error(
      `${messages.userSignTxGenericError}: ${objectToErrorString(
        modifiedPayloadObject,
      )} ${caughtError.message}`,
    );
  }
};
github JoinColony / purser / modules / node_modules / @colony / purser-software / staticMethods.js View on Github external
const { message, signature } = messageVerificationObjectValidator(
    signatureMessage,
  );
  try {
    const recoveredAddress: string = verifyEthersMessage(
      message,
      signature,
    );
    /*
     * Validate the recovered address
     */
    addressValidator(recoveredAddress);
    return address === recoveredAddress;
  } catch (caughtError) {
    throw new Error(
      `${messages.cannotVerifySignature} ${objectToErrorString(
        signatureMessage,
      )} Error: ${caughtError.message}`,
    );
  }
};
github JoinColony / purser / modules / node_modules / @colony / purser-ledger / staticMethods.js View on Github external
* Otherwise EthereumTx will complain because internally it checks for the valid instance
     */
    unsignedTransaction.r = hexSequenceNormalizer(rSignatureComponent);
    unsignedTransaction.s = hexSequenceNormalizer(sSignatureComponent);
    unsignedTransaction.v = hexSequenceNormalizer(recoveryParameter);
    const serializedSignedTransaction = unsignedTransaction
      .serialize()
      .toString(HEX_HASH_TYPE);
    /*
     * Add the hex prefix
     */
    return hexSequenceNormalizer(serializedSignedTransaction);
  } catch (caughtError) {
    return handleLedgerConnectionError(
      caughtError,
      `${messages.userSignTxGenericError}: ${objectToErrorString(
        transactionObject,
      )} ${caughtError.message}`,
    );
  }
};