<commit_before>class OpenModalService {
    constructor ($uibModal) {
        Object.assign(this, {$uibModal});
    }

    open(template, appendTo, scope, controller) {
        this.$uibModal.open({
            appendTo: appendTo,
            templateUrl: template,
            scope: scope,
            controller: controller,
            controllerAs: 'modalCtrl'
        }).result.then(function(e) {
            //Success
        }, function(e) {
            //Error
            if (!(e === 'cancel' || e === 'escape key press' || e === 'backdrop click')) {
                throw e;
            }
        });
    }
}

Mealpler.service('openModal', OpenModalService);<commit_msg>MP-45: added error handling to open modal service<commit_after>class OpenModalService {
    constructor ($uibModal) {
        Object.assign(this, {$uibModal});
    }

    open(template, appendTo, scope, controller) {
        this.$uibModal.open({
            appendTo: appendTo,
            templateUrl: template,
            scope: scope,
            controller: controller,
            controllerAs: 'modalCtrl'
        }).result.then(function(e) {
            //Success
        }, function(e) {
            //Error
            if (!(e === 'cancel' || e === 'escape key press' || e === 'backdrop click' || e === '$uibUnscheduledDestruction')) {
                throw e;
            }
        });
    }
}

Mealpler.service('openModal', OpenModalService);
{'fraction_non_alphanumeric': 0.1392757660167131, 'fraction_numerical': 0.001392757660167131, 'mean_word_length': 1.834319526627219, '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': '4902762', 'n_tokens_mistral': 394, 'n_tokens_neox': 388, 'n_words': 86}