<commit_before>from . import chime as app
from flask import current_app, render_template, session
from .view_functions import common_template_args

@app.app_errorhandler(404)
def page_not_found(error):
    kwargs = common_template_args(current_app.config, session)
    return render_template('error_404.html', **kwargs), 404

@app.app_errorhandler(500)
def internal_server_error(error):
    kwargs = common_template_args(current_app.config, session)
    return render_template('error_500.html', **kwargs), 500<commit_msg>starting to catch other types of errors<commit_after>from . import chime as app
from flask import current_app, render_template, session, request
from .view_functions import common_template_args
from .repo_functions import MergeConflict

@app.app_errorhandler(404)
def page_not_found(error):
    kwargs = common_template_args(current_app.config, session)
    kwargs.update({"message": u'No such URL: {}'.format(request.url)})
    return render_template('error_404.html', **kwargs), 404

@app.app_errorhandler(500)
def internal_server_error(error):
    kwargs = common_template_args(current_app.config, session)
    return render_template('error_500.html', **kwargs), 500

@app.app_errorhandler(MergeConflict)
def merge_conflict(error):
    new_files, gone_files, changed_files = error.files()
    kwargs = common_template_args(current_app.config, session)
    kwargs.update(new_files=new_files, gone_files=gone_files, changed_files=changed_files)
    kwargs.update({"message": u'It is a merge conflict, folks'})
    return render_template('error_500.html', **kwargs), 500

@app.app_errorhandler(Exception)
def exception(error):
    kwargs = common_template_args(current_app.config, session)
    kwargs.update({"message": error.args[0]})
    return render_template('error_500.html', **kwargs), 500
{'fraction_non_alphanumeric': 0.10737885462555066, 'fraction_numerical': 0.026982378854625552, 'mean_word_length': 6.731914893617021, 'pattern_counts': {'":': 3, '<': 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': '1596155', 'n_tokens_mistral': 589, 'n_tokens_neox': 543, 'n_words': 121}