{"action":"created","issue":{"url":"https://api.github.com/repos/flask-restful/flask-restful/issues/578","repository_url":"https://api.github.com/repos/flask-restful/flask-restful","labels_url":"https://api.github.com/repos/flask-restful/flask-restful/issues/578/labels{/name}","comments_url":"https://api.github.com/repos/flask-restful/flask-restful/issues/578/comments","events_url":"https://api.github.com/repos/flask-restful/flask-restful/issues/578/events","html_url":"https://github.com/flask-restful/flask-restful/issues/578","id":144255848,"number":578,"title":"Different error responses based on DEBUG flag","user":{"login":"Shanks512","id":8200720,"avatar_url":"https://avatars.githubusercontent.com/u/8200720?v=3","gravatar_id":"","url":"https://api.github.com/users/Shanks512","html_url":"https://github.com/Shanks512","followers_url":"https://api.github.com/users/Shanks512/followers","following_url":"https://api.github.com/users/Shanks512/following{/other_user}","gists_url":"https://api.github.com/users/Shanks512/gists{/gist_id}","starred_url":"https://api.github.com/users/Shanks512/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shanks512/subscriptions","organizations_url":"https://api.github.com/users/Shanks512/orgs","repos_url":"https://api.github.com/users/Shanks512/repos","events_url":"https://api.github.com/users/Shanks512/events{/privacy}","received_events_url":"https://api.github.com/users/Shanks512/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-03-29T12:53:55Z","updated_at":"2016-07-18T17:27:53Z","closed_at":null,"body":"Not sure if this is a bug or a gap in my understanding (I am very new to Flask, and Python in general).\r\n\r\nSince I felt constrained by the dict-based error handling in Flask-Restful, I used the 'errorhandler' decorator provided by Flask. The issue is, the errorhandlers work fine when DEBUG=True (and show custom error responses that I have set up), but show a cryptic `{'message': 'Internal Server Error'}` when DEBUG=False.\r\n\r\nAfter a lot of struggle, I figured out that it was due to 2 reasons:\r\n\r\n1. The PROPAGATE_ERRORS flag being set and unset on DEBUG=True/False. \r\n2. This snippet of code in the `flask_restful/__init__.py` file:\r\n```python\r\n        if not isinstance(e, HTTPException) and current_app.propagate_exceptions:\r\n            exc_type, exc_value, tb = sys.exc_info()\r\n            if exc_value is e:\r\n                raise\r\n            else:\r\n                raise e\r\n\r\n        headers = Headers()\r\n        if isinstance(e, HTTPException):\r\n            code = e.code\r\n            default_data = {\r\n                'message': getattr(e, 'description', http_status_message(code))\r\n            }\r\n            headers = e.get_response().headers\r\n        else:\r\n            code = 500\r\n            default_data = {\r\n                'message': http_status_message(code),\r\n            }\r\n```\r\n\r\nwhich raises the exception and lets the flask errorhandler deal with it if propagate_exceptions is True, but handles the exception by itself if otherwise.\r\n\r\nI have 2 suggestions:\r\n1. You should mention in the documentation that Flask-Restful overrides the default Flask error handlers.\r\n2. Since you _are_ overriding the error handlers, should you even care whether propagate_exceptions is True or False?\r\n\r\nIt looks weird to me that flask_restful handles error responses differently based on the DEBUG flag. Is there a way I can disable FR error handling? Is there a flexible error handing option in FR so that I can avoid the Flask errorhandler ?"},"comment":{"url":"https://api.github.com/repos/flask-restful/flask-restful/issues/comments/233398270","html_url":"https://github.com/flask-restful/flask-restful/issues/578#issuecomment-233398270","issue_url":"https://api.github.com/repos/flask-restful/flask-restful/issues/578","id":233398270,"user":{"login":"congbo","id":4121131,"avatar_url":"https://avatars.githubusercontent.com/u/4121131?v=3","gravatar_id":"","url":"https://api.github.com/users/congbo","html_url":"https://github.com/congbo","followers_url":"https://api.github.com/users/congbo/followers","following_url":"https://api.github.com/users/congbo/following{/other_user}","gists_url":"https://api.github.com/users/congbo/gists{/gist_id}","starred_url":"https://api.github.com/users/congbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/congbo/subscriptions","organizations_url":"https://api.github.com/users/congbo/orgs","repos_url":"https://api.github.com/users/congbo/repos","events_url":"https://api.github.com/users/congbo/events{/privacy}","received_events_url":"https://api.github.com/users/congbo/received_events","type":"User","site_admin":false},"created_at":"2016-07-18T17:27:53Z","updated_at":"2016-07-18T17:27:53Z","body":"I have this question too."}}
{"actor":{"display_login":"congbo"}}