Композитор не возвращает значение - PullRequest
0 голосов
/ 25 января 2019

Функция работала для 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;
    }
...