<commit_before>/**
 * Feeds
 * @namespace pj-feed.feeds.services
 */

(function () {
    'use strict';

    angular
	.module('pjfeedreader.feeds.services')
	.factory('Feeds', ['$http', Feeds]);

    /**
     * @namespace Feeds
     * @returns {Factory}
     */

    function Feeds($http) {
	var Feeds = {
	    add: add,
	    all: all
	};
	return Feeds;
	
	/**
	 * @name add
	 * @desc Add new feed
	 * @param
	 * @returns {Promise}
	 * @memberOf pjfeedreader.feeds.services.Feeds
	 */

	function add(url, title, category) {
	    return $http.post('/feedreader/api/v1/feeds/', {
		'url': url,
		'title': title,
		'category': category
	    });
	}
	
	/**
	 * @name all
	 * @desc get existing feeds
	 * @param
	 * @returns {Promise}
	 * @memberOf pjfeedreader.feeds.services.Feeds
	 */
	function all() {
	    return $http.get('/feedreader/api/v1/feeds/');
	}
    }
})();

<commit_msg>refactor(feed): Feed service is handling http failures<commit_after>/**
 * Feeds
 * @namespace pj-feed.feeds.services
 */

(function () {
    'use strict';

    angular
        .module('pjfeedreader.feeds.services')
        .factory('Feeds', ['$http', Feeds]);

    /**
     * @namespace Feeds
     * @returns {Factory}
     */

    function Feeds($http) {
        var Feeds = {
            add: add,
            all: all
        };
        return Feeds;
	
	/**
	 * @name add
	 * @desc Add new feed
	 * @param
	 * @returns {Promise}
	 * @memberOf pjfeedreader.feeds.services.Feeds
	 */

        function add(url, title, category) {
            return $http.post('/feedreader/api/v1/feeds/', {
                'url': url,
                'title': title,
                'category': category
            }).then(addFeedSuccessFn, addFeedErrorFn);
        }

        /**
         * @name addFeedSuccessFn
         * @desc Show success message
         */

        function addFeedSuccessFn(data, status, headers, config) {
            console.log('Adding feed succesfully');
        }

        /**
         * @name addCategoryErrorFn
         * @desc Show success message
         */

        function addFeedErrorFn(data, status, headers, config) {
            console.log('Error in adding');
            console.log(data);
            console.log(data.error);
        }

	/**
	 * @name all
	 * @desc get existing feeds
	 * @param
	 * @returns {Promise}
	 * @memberOf pjfeedreader.feeds.services.Feeds
	 */
        function all() {
            return $http.get('/feedreader/api/v1/feeds/');
        }
    }
})();


{'fraction_non_alphanumeric': 0.1509433962264151, 'fraction_numerical': 0.0016057808109193096, 'mean_word_length': 1.949112426035503, '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': '2764181', 'n_tokens_mistral': 839, 'n_tokens_neox': 779, 'n_words': 166}