<commit_before>var get = Ember.get;

Ember.View.reopen({
    templateForName: function(name, type) {
        if (!name) {
            return;
        }

        var templates = get(this, 'templates'),
        template = get(templates, name);

        if (!template) {
            template = require(name);
            if (!template) {
                throw new Ember.Error(fmt('%@ - Unable to find %@ "%@".', [this, type, name]));
            }
        }

        return template;
    }
});
<commit_msg>change error handling when template is not available<commit_after>var get = Ember.get, fmt = Ember.String.fmt;

Ember.View.reopen({
    templateForName: function(name, type) {
        if (!name) {
            return;
        }

        var templates = get(this, 'templates'),
        template = get(templates, name);

        if (!template) {
            try {
              template = require(name);
            } catch (error) { throw error; }

            if (!template) {
                throw new Ember.Error(fmt('%@ - Unable to find %@ "%@".', [this, type, name]));
            }
        }

        return template;
    }
});

{'fraction_non_alphanumeric': 0.14185022026431718, 'fraction_numerical': 0.0, 'mean_word_length': 1.6729411764705882, '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': '5124119', 'n_tokens_mistral': 332, 'n_tokens_neox': 320, 'n_words': 82}