Add traceback error

This patch adds the traceback error to be emmitted to the stderr when
Kuryr catches the exceptions for making debugging easier.

Change-Id: I74c6dc8c075c06f3fe3b9508e2dc5f523196b795
Signed-off-by: Taku Fukushima <f.tac.mac@gmail.com>
This commit is contained in:
Taku Fukushima 2015-10-07 11:56:17 +09:00
parent 3ebedcf80d
commit 7a4838a493

View File

@ -11,6 +11,8 @@
# under the License.
import os
import sys
import traceback
import flask
import jsonschema
@ -62,6 +64,7 @@ def make_json_app(import_name, **kwargs):
@app.errorhandler(jsonschema.ValidationError)
def make_json_error(ex):
app.logger.error("Unxepected error happened: {0}".format(ex))
traceback.print_exc(file=sys.stderr)
response = flask.jsonify({"Err": str(ex)})
response.status_code = 500
if isinstance(ex, w_exceptions.HTTPException):