def serialize_many(self, instances, *args, **kw): """Immediately raises a :exc:`SerializationException`. This function requires `instances` to be non-empty. """ raise SerializationException(instances[0])
def raise_s_exception(instance, *args, **kw): """Immediately raises a :exc:`SerializationException` with access to the provided `instance` of a SQLAlchemy model. This function is useful for use in tests for serialization exceptions. """ raise SerializationException(instance)
def serialize(self, instance, *args, **kwargs): raise SerializationException(instance, resource_id=instance.id, resource_type=resource_type)
def serialize(self, instance, *args, **kwargs): raise SerializationException(instance, message='foo')
def serialize(self, instance, *args, **kw): """Immediately raises a :exc:`SerializationException` with access to the provided `instance` of a SQLAlchemy model. """ raise SerializationException(instance)
def _dump(self, instance, *args, **kw): message = 'failed on {0}'.format(instance.id) raise SerializationException(instance, message=message)
def serialize_many(self, instances, *args, **kw): instance1, instance2 = instances[:2] exception1 = SerializationException(instance1, message='foo') exception2 = SerializationException(instance2, message='bar') exceptions = [exception1, exception2] raise MultipleExceptions(exceptions)
def raise_with_msg(instance, *args, **kw): raise SerializationException(instance, message='foo')