<commit_before>(function(){
    app = app || angular.module(module || 'psfs', ['ngMaterial', 'ngSanitize', 'bw.paging']);

    var listCtrl = ['$scope', '$log', '$http', '$mdDialog', '$msgSrv', '$apiSrv', '$timeout',
    function($scope, $log, $http, $mdDialog, $msgSrv, $apiSrv, $timeout){
        $scope.loading = false;
        $scope.limit = globalLimit || 25;
        $scope.actualPage = 1;
        $scope.count = 0;
        $scope.listSearch = '';

        function catchError(response)
        {
            $mdDialog.show(
                $mdDialog.alert()
                    .clickOutsideToClose(true)
                    .title($scope.i18N['generic_error_label'])
                    .content(response)
                    .ariaLabel('Alert Error Dialog')
                    .ok($scope.i18N['close'])
            );
            $scope.loading = false;
        }

        function paginate(page)
        {
            $scope.actualPage = page || 1;
            loadData();
        }

        function checkItem(item)
        {
            var isModel = false;
            for(var i in $scope.form.fields) {
                var field = $scope.form.fields[i];
                if(field.pk) {
                    isModel = (item[field.name] === $scope.model[field.name]);
                }
            }
            return isModel;
        }

        function loadData(clean)
        {
            if(clean) addNewItem();
            var queryParams = {
                '__limit': $scope.limit,
                '__page': $scope.actualPage,
                '__fields': $scope.listLabel
            };
            if($scope.listSearch.replace(/\ /ig, '').length > 0) {
                queryParams['__combo'] = $scope.listSearch;
            }
            $scope.loading = true;
            try {
                $http.get($scope.url, {params: queryParams})
                    .then(function(result) {
                        $log.info(result);
                        $scope.list = result.data.data;
                        $timeout(function(){
                            $scope.loading = false;
                        }, 500);
                        $scope.count = result.data.total;
                    }, catchError);
            } catch(err) {
                $log.error(err.message);
            }
        }

        function deleteItem(item)
        {
            $scope.loading = true;
            var confirm = $mdDialog.confirm()
                .title($scope.i18N['confirm_delete_label'].replace('%entity%', $apiSrv.getLabel(item)))
                .content($scope.i18N['confirm_delete_message'])
                .ariaLabel('Delete Element')
                .ok($scope.i18N['delete'])
                .cancel($scope.i18N['cancel']);
            $mdDialog.show(confirm).then(function() {
                $http.delete($scope.url + "/" + item[$scope.modelId])
                    .then(function() {
                        $timeout(function() {
                            if(checkItem(item)) {
                                addNewItem();
                            }
                            loadData();
                        }, 250);
                    }, function(err, statu){
                        $mdDialog.show(
                            $mdDialog.alert()
                                .clickOutsideToClose(true)
                                .title($scope.entity + '<br> Error ' + status)
                                .content(err)
                                .ariaLabel('Delete error')
                                .ok($scope.i18N['close'])
                        );
                    });
            }, function() {
                $scope.loading = false;
            });
        }

        function loadItem(item)
        {
            $scope.itemLoading = true;
            $http.get($scope.url + "/" + item[$scope.modelId])
                .then(function(response) {
                    $scope.model = response.data.data;
                    $msgSrv.send('populate_combos');
                    $timeout(function(){
                        $scope.itemLoading = false;
                    }, 500);
                }, function(err, status) {
                    $mdDialog.show(
                        $mdDialog.alert()
                            .clickOutsideToClose(true)
                            .title($scope.entity + '<br> Error ' + status)
                            .content(err)
                            .ariaLabel('Delete error')
                            .ok($scope.i18N['close'])
                    );
                });
        }

        function isModelSelected() {
            return !angular.equals({}, $scope.model);
        }

        function cleanFormStatus(element) {
            if(typeof element === 'object' && '$setDirty' in element) {
                element.$setDirty(false);
                element.$setPristine(false);
            }
        }

        function addNewItem() {
            $scope.model = {};
            cleanFormStatus($scope.entity_form);
            for(var i in $scope.entity_form) {
                var _field = $scope.entity_form[i];
                cleanFormStatus(_field);
            }
            $msgSrv.send('populate_combos');
        }
<commit_msg>FIxed error message trying to delete<commit_after>(function(){
    app = app || angular.module(module || 'psfs', ['ngMaterial', 'ngSanitize', 'bw.paging']);

    var listCtrl = ['$scope', '$log', '$http', '$mdDialog', '$msgSrv', '$apiSrv', '$timeout',
    function($scope, $log, $http, $mdDialog, $msgSrv, $apiSrv, $timeout){
        $scope.loading = false;
        $scope.limit = globalLimit || 25;
        $scope.actualPage = 1;
        $scope.count = 0;
        $scope.listSearch = '';

        function catchError(response)
        {
            $mdDialog.show(
                $mdDialog.alert()
                    .clickOutsideToClose(true)
                    .title($scope.i18N['generic_error_label'])
                    .content(response)
                    .ariaLabel('Alert Error Dialog')
                    .ok($scope.i18N['close'])
            );
            $scope.loading = false;
        }

        function paginate(page)
        {
            $scope.actualPage = page || 1;
            loadData();
        }

        function checkItem(item)
        {
            var isModel = false;
            for(var i in $scope.form.fields) {
                var field = $scope.form.fields[i];
                if(field.pk) {
                    isModel = (item[field.name] === $scope.model[field.name]);
                }
            }
            return isModel;
        }

        function loadData(clean)
        {
            if(clean) addNewItem();
            var queryParams = {
                '__limit': $scope.limit,
                '__page': $scope.actualPage,
                '__fields': $scope.listLabel
            };
            if($scope.listSearch.replace(/\ /ig, '').length > 0) {
                queryParams['__combo'] = $scope.listSearch;
            }
            $scope.loading = true;
            try {
                $http.get($scope.url, {params: queryParams})
                    .then(function(result) {
                        $log.info(result);
                        $scope.list = result.data.data;
                        $timeout(function(){
                            $scope.loading = false;
                        }, 500);
                        $scope.count = result.data.total;
                    }, catchError);
            } catch(err) {
                $scope.loading = false;
                $log.error(err.message);
            }
        }

        function deleteItem(item)
        {
            $scope.loading = true;
            var confirm = $mdDialog.confirm()
                .title($scope.i18N['confirm_delete_label'].replace('%entity%', $apiSrv.getLabel(item)))
                .content($scope.i18N['confirm_delete_message'])
                .ariaLabel('Delete Element')
                .ok($scope.i18N['delete'])
                .cancel($scope.i18N['cancel']);
            $mdDialog.show(confirm).then(function() {
                $http.delete($scope.url + "/" + item[$scope.modelId])
                    .then(function() {
                        $timeout(function() {
                            if(checkItem(item)) {
                                addNewItem();
                            }
                            loadData();
                        }, 250);
                    }, function(err, status){
                        $mdDialog.show(
                            $mdDialog.alert()
                                .clickOutsideToClose(true)
                                .title($scope.entity + ' Error ' + status)
                                .content(err.data.data)
                                .ariaLabel('Delete error')
                                .ok($scope.i18N['close'])
                        );
                        $scope.loading = false;
                    });
            }, function() {
                $scope.loading = false;
            });
        }

        function loadItem(item)
        {
            $scope.itemLoading = true;
            $http.get($scope.url + "/" + item[$scope.modelId])
                .then(function(response) {
                    $scope.model = response.data.data;
                    $msgSrv.send('populate_combos');
                    $timeout(function(){
                        $scope.itemLoading = false;
                    }, 500);
                }, function(err, status) {
                    $mdDialog.show(
                        $mdDialog.alert()
                            .clickOutsideToClose(true)
                            .title($scope.entity + ' Error ' + status)
                            .content(err)
                            .ariaLabel('Delete error')
                            .ok($scope.i18N['close'])
                    );
                    $scope.loading = false;
                });
        }

        function isModelSelected() {
            return !angular.equals({}, $scope.model);
        }

        function cleanFormStatus(element) {
            if(typeof element === 'object' && '$setDirty' in element) {
                element.$setDirty(false);
                element.$setPristine(false);
            }
        }

        function addNewItem() {
            $scope.model = {};
            cleanFormStatus($scope.entity_form);
            for(var i in $scope.entity_form) {
                var _field = $scope.entity_form[i];
                cleanFormStatus(_field);
            }
            $msgSrv.send('populate_combos');
        }

{'fraction_non_alphanumeric': 0.1279656267513544, 'fraction_numerical': 0.005791145152251074, 'mean_word_length': 1.0871345029239765, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '7558745', 'n_tokens_mistral': 2813, 'n_tokens_neox': 2623, 'n_words': 413}