<commit_before>(function () {
    'use strict';

    var POLLING_DELAY = 5000;

    function getPairIds(pair) {
        return {
            amountAssetId: pair.amountAsset.id,
            priceAssetId: pair.priceAsset.id
        };
    }

    function DexController($scope, $interval, applicationContext, assetStoreFactory,
                           dexOrderService, dexOrderbookService, notificationService) {
        var ctrl = this,
            intervalPromise,

            // TODO : inside the store, get the markets from matcher.
            // assetStore = assetStoreFactory.createStore({
            //     address: applicationContext.account.address,
            //     markets: true
            // }),

            assetStore = assetStoreFactory.createStore(applicationContext.account.address),

            sender = {
                publicKey: applicationContext.account.keyPair.public,
                privateKey: applicationContext.account.keyPair.private
            };

        ctrl.assetsList = [];

        ctrl.pair = {
            amountAsset: Currency.WAV,
            priceAsset: Currency.BTC
        };

        ctrl.buyOrders = [];
        ctrl.sellOrders = [];
        ctrl.userOrders = [];

        ctrl.createOrder = function (type, price, amount, callback) {
            // TODO : add a queue for the orders which weren't yet accepted.
            dexOrderService
                .addOrder(getPairIds(ctrl.pair), {
                    orderType: type,
                    amount: Money.fromTokens(amount, ctrl.pair.amountAsset),
                    price: Money.fromTokens(price, ctrl.pair.priceAsset),
                    fee: Money.fromTokens(0.01, Currency.WAV)
                }, sender)
                .then(function () {
                    refreshOrderbooks();
                    refreshUserOrders();
                    notificationService.notice('Order has been created!');
                    if (callback) {
                        callback();
                    }
                })
                .catch(function () {
                    notificationService.error('Order has not been created!');
                    if (callback) {
                        callback();
                    }
                });
        };

        ctrl.cancelOrder = function (order) {
            // TODO : add a queue for the orders which weren't yet canceled.
            dexOrderService
                .removeOrder(getPairIds(ctrl.pair), order, sender)
                .then(function () {
                    refreshOrderbooks();<commit_msg>Added meaningful error message (Taiga #601)<commit_after>(function () {
    'use strict';

    var POLLING_DELAY = 5000;

    function getPairIds(pair) {
        return {
            amountAssetId: pair.amountAsset.id,
            priceAssetId: pair.priceAsset.id
        };
    }

    function DexController($scope, $interval, applicationContext, assetStoreFactory,
                           dexOrderService, dexOrderbookService, notificationService) {
        var ctrl = this,
            intervalPromise,

            // TODO : inside the store, get the markets from matcher.
            // assetStore = assetStoreFactory.createStore({
            //     address: applicationContext.account.address,
            //     markets: true
            // }),

            assetStore = assetStoreFactory.createStore(applicationContext.account.address),

            sender = {
                publicKey: applicationContext.account.keyPair.public,
                privateKey: applicationContext.account.keyPair.private
            };

        ctrl.assetsList = [];

        ctrl.pair = {
            amountAsset: Currency.WAV,
            priceAsset: Currency.BTC
        };

        ctrl.buyOrders = [];
        ctrl.sellOrders = [];
        ctrl.userOrders = [];

        ctrl.createOrder = function (type, price, amount, callback) {
            // TODO : add a queue for the orders which weren't yet accepted.
            dexOrderService
                .addOrder(getPairIds(ctrl.pair), {
                    orderType: type,
                    amount: Money.fromTokens(amount, ctrl.pair.amountAsset),
                    price: Money.fromTokens(price, ctrl.pair.priceAsset),
                    fee: Money.fromTokens(0.01, Currency.WAV)
                }, sender)
                .then(function () {
                    refreshOrderbooks();
                    refreshUserOrders();
                    notificationService.notice('Order has been created!');
                    if (callback) {
                        callback();
                    }
                })
                .catch(function (e) {
                    var errorMessage = e.data ? e.data.message : null;
                    notificationService.error(errorMessage || 'Order has not been created!');
                    if (callback) {
                        callback();
                    }
                });
        };

        ctrl.cancelOrder = function (order) {
            // TODO : add a queue for the orders which weren't yet canceled.
            dexOrderService
                .removeOrder(getPairIds(ctrl.pair), order, sender)
                .then(function () {
                    refreshOrderbooks();
{'fraction_non_alphanumeric': 0.09339407744874716, 'fraction_numerical': 0.0032270311313591497, 'mean_word_length': 1.4092363968907178, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3065396', 'n_tokens_mistral': 1294, 'n_tokens_neox': 1192, 'n_words': 263}