view wikked/views/error.py @ 147:d7890b46358e

Split all Flask views into separate modules.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 11 Dec 2013 21:51:26 -0800
parents
children 37f426e067c4
line wrap: on
line source

from flask import jsonify
from wikked.scm.base import SourceControlError
from wikked.web import app


@app.errorhandler(SourceControlError)
def handle_source_control_error(error):
    app.log_exception(error)
    resp = {
            'error': {
                'type': 'source_control',
                'operation': error.operation,
                'message': error.message
                }
            }
    return jsonify(resp), 500