作曲家不返回值

时间:2019-01-24 22:51:48

标签: hyperledger hyperledger-composer

该功能适用​​于composer-client@0.19.3,升级到composer-client@0.19.19后,出现此错误:

Transaction Create Error Error: A return value of type Cashier was expected for transaction com.emastersapp.TournamentTransaction#1f119ee4bf19644c786da69f360cd348026e3cc362de74311e349b09d9d2f4a5, but nothing was returned by any functions
at BusinessNetworkConnection._processReturnData (/var/task/node_modules/composer-client/lib/businessnetworkconnection.js:568:27)
at BusinessNetworkConnection.submitTransaction (/var/task/node_modules/composer-client/lib/businessnetworkconnection.js:539:29)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)

错误来自composer-client / businessnetworkconnection

/**
     * Process the return data for the specified transaction.
     * @private
     * @param {Resource} transaction The transaction.
     * @param {Buffer} data The return data.
     * @return {*} The processed return data.
     */
    _processReturnData(transaction, data) {
        const method = '_processReturnData';
        LOG.entry(method, transaction, data);

        // Determine whether or not a result was expected.
        const transactionDeclaration = transaction.getClassDeclaration();
        const returnsDecorator = transactionDeclaration.getDecorator('returns');
        if (!returnsDecorator) {
            LOG.exit(method, undefined);
            return undefined;
        }

        // Ensure some data was returned.
        const returnValueType = returnsDecorator.getType();
        const isArray = returnsDecorator.isArray();
        const formattedExpectedType = `${returnValueType}${isArray ? '[]' : ''}`;
        if (!data) {
            const error = new Error(`A return value of type ${formattedExpectedType} was expected for transaction ${transaction.getFullyQualifiedIdentifier()}, but nothing was returned by any functions`);
            LOG.error(method, error);
            throw error;
        }

        // Handle enum return values.
        if (returnsDecorator.isTypeEnum()) {
            const result = this._processEnumReturnData(transaction, data);
            LOG.exit(method, result);
            return result;
        }

        // Handle non-primitive return values.
        if (!returnsDecorator.isPrimitive()) {
            const result = this._processComplexReturnData(transaction, data);
            LOG.exit(method, result);
            return result;
        }

        // Handle primitive return values.
        const result = this._processPrimitiveReturnData(transaction, data);
        LOG.exit(method, result);
        return result;
    }

0 个答案:

没有答案