Capture stack frame before logging, so we can re-raise later

Change-Id: Idc2a1d0cd1a21f3939786a1725611c80c4470b03
This commit is contained in:
Tim Burke 2015-07-13 13:46:21 -07:00
parent daf6ec8e29
commit c1185d1d57
6 changed files with 23 additions and 6 deletions

View File

@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
from swift3.subresource import ACL, Owner, encode_acl
from swift3.response import MissingSecurityHeader, \
MalformedACLError, UnexpectedContent
@ -67,8 +69,9 @@ def get_acl(headers, body, bucket_owner, object_owner=None):
except(XMLSyntaxError, DocumentInvalid):
raise MalformedACLError()
except Exception as e:
exc_type, exc_value, exc_traceback = sys.exc_info()
LOGGER.error(e)
raise
raise exc_type, exc_value, exc_traceback
else:
if body:
# Specifying grant with both header and xml is not allowed.

View File

@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
from swift.common.http import HTTP_OK
from swift.common.utils import json
@ -133,8 +135,9 @@ class BucketController(Controller):
except (XMLSyntaxError, DocumentInvalid):
raise MalformedXML()
except Exception as e:
exc_type, exc_value, exc_traceback = sys.exc_info()
LOGGER.error(e)
raise
raise exc_type, exc_value, exc_traceback
if location != CONF.location:
# Swift3 cannot support multiple reagions now.

View File

@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
from swift3.controllers.base import Controller, bucket_operation
from swift3.etree import Element, SubElement, fromstring, tostring, \
XMLSyntaxError, DocumentInvalid
@ -76,8 +78,9 @@ class MultiObjectDeleteController(Controller):
except ErrorResponse:
raise
except Exception as e:
exc_type, exc_value, exc_traceback = sys.exc_info()
LOGGER.error(e)
raise
raise exc_type, exc_value, exc_traceback
elem = Element('DeleteResult')

View File

@ -44,6 +44,7 @@ upload information:
import os
import re
import sys
from swift.common.utils import json
from swift.common.db import utf8encode
@ -515,8 +516,9 @@ class UploadController(Controller):
except ErrorResponse:
raise
except Exception as e:
exc_type, exc_value, exc_traceback = sys.exc_info()
LOGGER.error(e)
raise
raise exc_type, exc_value, exc_traceback
try:
# TODO: add support for versioning

View File

@ -13,6 +13,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import sys
from swift.common.http import HTTP_OK, HTTP_PARTIAL_CONTENT
from swift.common.swob import Range, content_range_header_value
@ -114,6 +116,7 @@ class ObjectController(Controller):
resp = req.get_response(self.app)
except NoSuchKey:
# expect to raise NoSuchBucket when the bucket doesn't exist
exc_type, exc_value, exc_traceback = sys.exc_info()
req.get_container_info(self.app)
raise
raise exc_type, exc_value, exc_traceback
return resp

View File

@ -17,6 +17,8 @@ import lxml.etree
from urllib import quote
from copy import deepcopy
from pkg_resources import resource_stream # pylint: disable-msg=E0611
import sys
from swift3.exception import S3Exception
from swift3.utils import LOGGER, camel_to_snake, utf8encode, utf8decode
@ -70,8 +72,9 @@ def fromstring(text, root_tag=None):
lxml.etree.RelaxNG(file=rng).assertValid(elem)
except IOError as e:
# Probably, the schema file doesn't exist.
exc_type, exc_value, exc_traceback = sys.exc_info()
LOGGER.error(e)
raise
raise exc_type, exc_value, exc_traceback
except lxml.etree.DocumentInvalid as e:
LOGGER.debug(e)
raise DocumentInvalid(e)