Merge "Do not print unhandled exception if in production" into stable/6.1
This commit is contained in:
commit
9e2823cb44
|
@ -15,7 +15,6 @@
|
|||
# under the License.
|
||||
|
||||
from datetime import datetime
|
||||
import six
|
||||
import traceback
|
||||
|
||||
from decorator import decorator
|
||||
|
@ -292,12 +291,13 @@ def content_json(func, cls, *args, **kwargs):
|
|||
raise
|
||||
# intercepting all errors to avoid huge HTML output
|
||||
except Exception as exc:
|
||||
logger.exception('Unexpected exception occured')
|
||||
http_error = BaseHandler.http(
|
||||
500,
|
||||
(
|
||||
traceback.format_exc(exc)
|
||||
if settings.DEVELOPMENT
|
||||
else six.text_type(exc)
|
||||
else 'Unexpected exception, please check logs'
|
||||
)
|
||||
)
|
||||
http_error.data = json_resp(http_error.data)
|
||||
|
|
|
@ -69,7 +69,7 @@ class TestVersionApi(BaseAuthenticationIntegrationTest):
|
|||
|
||||
@patch('nailgun.api.v1.handlers.version.utils.get_fuel_release_versions')
|
||||
def test_500_no_html_production(self, handler_get):
|
||||
exc_text = "Here goes an exception"
|
||||
exc_text = "Unexpected exception, please check logs"
|
||||
handler_get.side_effect = Exception(exc_text)
|
||||
self.headers['X-Auth-Token'] = self.token
|
||||
with patch('nailgun.settings.settings.DEVELOPMENT', 0):
|
||||
|
|
Loading…
Reference in New Issue