Beispiel #1
0
	def wrapper(object):
		"""
		This decorator is used for exceptions handling.

		:param object: Object to decorate. ( Object )
		:return: Object. ( Object )
		"""

		traceName = core.getTraceName(object)

		@functools.wraps(object)
		def function(*args, **kwargs):
			"""
			This decorator is used for exceptions handling.

			:param \*args: Arguments. ( \* )
			:param \*\*kwargs: Keywords arguments. ( \*\* )
			"""

			__stackTraceFrameTag__ = Constants.excludeTaggedFramesFromStackTrace

			exception = None

			try:
				return object(*args, **kwargs)
			except exceptions as exception:
				handler(exception, traceName, *args, **kwargs)
			except Exception as exception:
				handler(exception, traceName, *args, **kwargs)
			finally:
				if raiseException and exception:
					raise exception
		return function
Beispiel #2
0
	def testGetObjectName(self):
		"""
		This method tests :func:`foundations.core.getTraceName` definition.
		"""

		objectName = core.getTraceName(object)
		self.assertIsInstance(objectName, str)
		self.assertEqual(objectName, "__builtin__ | testGetObjectName.object()")