def test_from_error_serializable(self): try: e = Exception() e.random = {"foo": "bar"} raise e except Exception: wrapped_exc = InternalError.from_error(sys.exc_info(), json.JSONEncoder) json.dumps(wrapped_exc.as_error_object())
def test_from_error_not_serializable(self): class NonSerializableObject(object): pass try: e = Exception() e.random = NonSerializableObject() raise e except Exception: wrapped_exc = InternalError.from_error(sys.exc_info(), json.JSONEncoder) json.dumps(wrapped_exc.as_error_object())