]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Change default Exception code to 500
authorJohn Griffith <john.griffith8@gmail.com>
Tue, 13 Oct 2015 03:44:09 +0000 (21:44 -0600)
committerSean Dague <sean@dague.net>
Tue, 13 Oct 2015 15:52:47 +0000 (11:52 -0400)
As a part of the fix for LP#1505153, the invalid
response of 0 was changed to 400 to fix a running
issue with the new version of WebOb.

It was pointed out after the fact  however that a
500 might be more appropriate here.

Additionally, other projects have implemented a 500
as the default so for the sake of consistency we should
consider doing the same.

This patch just changes the 400 to a 500 as the default
code.

Change-Id: Ie486dc49c927f9b50f07c1fc562e89c090924a40
Closes-Bug: #1505488

cinder/exception.py
cinder/tests/unit/test_exception.py

index 2fed70b0b22b1c0533a2bf3714eff5f201b235e2..ef50bd67bc3b97c6222cf6740d46bc8c2f16a9bd 100644 (file)
@@ -48,7 +48,7 @@ CONF.register_opts(exc_log_opts)
 
 
 class ConvertedException(webob.exc.WSGIHTTPException):
-    def __init__(self, code=400, title="", explanation=""):
+    def __init__(self, code=500, title="", explanation=""):
         self.code = code
         # There is a strict rule about constructing status line for HTTP:
         # '...Status-Line, consisting of the protocol version followed by a
index b8591b43599061baac9524ca120f089d24c5941f..76d75a027236d9a95c635b7466a572dae89c0e60 100644 (file)
@@ -107,7 +107,7 @@ class CinderConvertedExceptionTestCase(test.TestCase):
     def test_default_args(self):
         exc = exception.ConvertedException()
         self.assertNotEqual('', exc.title)
-        self.assertEqual(400, exc.code)
+        self.assertEqual(500, exc.code)
         self.assertEqual('', exc.explanation)
 
     def test_standard_status_code(self):