@@ -0,0 +1,1440 @@
+from flask import jsonify, make_response%0Afrom flask_api import status    # HTTP Status Codes%0Afrom app import app%0A%0A######################################################################%0A# Custom Exceptions%0A######################################################################%0Aclass DataValidationError(ValueError):%0A    pass%0A%0A######################################################################%0A# ERROR Handling%0A######################################################################%0A%0A@app.errorhandler(DataValidationError)%0Adef request_validation_error(e):%0A    return make_response(jsonify(status=400, error='Bad Request', message=e.message), status.HTTP_400_BAD_REQUEST)%0A%0A@app.errorhandler(404)%0Adef not_found(e):%0A    return make_response(jsonify(status=404, error='Not Found', message=e.description), status.HTTP_404_NOT_FOUND)%0A%0A@app.errorhandler(400)%0Adef bad_request(e):%0A    return make_response(jsonify(status=400, error='Bad Request', message=e.message), status.HTTP_400_BAD_REQUEST)%0A%0A@app.errorhandler(405)%0Adef method_not_allowed(e):%0A    return make_response(jsonify(status=405, error='Method not Allowed', message='Your request method is not supported. Check your HTTP method and try again.'), status.HTTP_405_METHOD_NOT_ALLOWED)%0A%0A@app.errorhandler(500)%0Adef internal_error(e):%0A    return make_response(jsonify(status=500, error='Internal Server Error', message='Well, this is embarrassing...'), status.HTTP_500_INTERNAL_SERVER_ERROR)%0A

add error_handlers for common http errors. moved DataValidationError from models to here