<commit_before>angular.module('bitvagas.main.factory',[])
.factory('ErrorHandling', function(){

    var handler = {};

    handler.getErrors = function(data){
        var errorList = [];
        if(typeof data === 'object')
            //Get a list of errors
            for(var errorIndex in data.errors)
                errorList.push(data.errors[errorIndex].message);
        else
            //Single error
            errorList.push(data);

        return errorList;
    }

    return handler
});
<commit_msg>improve error handling to get data.message errors<commit_after>angular.module('bitvagas.main.factory',[])
.factory('ErrorHandling', function(){

    var handler = {};

    handler.getErrors = function(data){
        var errorList = [];
        if(typeof data === 'object')
            if(data.errors !== undefined)
                //Get a list of errors
                for(var errorIndex in data.errors)
                    errorList.push(data.errors[errorIndex].message);
            else
                errorList.push(data.message);
        else
            //Single error
            errorList.push(data);

        return errorList;
    }

    return handler
});

{'fraction_non_alphanumeric': 0.12003381234150465, 'fraction_numerical': 0.0, 'mean_word_length': 1.9306930693069306, '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': '7316760', 'n_tokens_mistral': 318, 'n_tokens_neox': 302, 'n_words': 70}