API proposal for functest
[functest-xtesting.git] / functest / api / common / error.py
1 #!/usr/bin/env python
2
3 # Copyright (c) 2017 Huawei Technologies Co.,Ltd and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9
10 """
11 Used to handle results
12
13 """
14
15 from flask import jsonify
16
17
18 def result_handler(status, data):
19     """ Return the json format of result in dict """
20     result = {
21         'status': status,
22         'result': data
23     }
24     return jsonify(result)