Commit 76902066 by Miles Richardson

return ParseBatchError with list of errors when a batch operation fails

parent bc0ad58a
...@@ -189,10 +189,10 @@ class ParseBatcher(ParseBase): ...@@ -189,10 +189,10 @@ class ParseBatcher(ParseBase):
if "success" in response: if "success" in response:
callback(response["success"]) callback(response["success"])
else: else:
batched_errors.append(core.ParseError(response["error"])) batched_errors.append(response["error"])
if batched_errors: if batched_errors:
raise batched_errors[0] raise core.ParseBatchError(batched_errors)
def batch_save(self, objects): def batch_save(self, objects):
"""save a list of objects in one operation""" """save a list of objects in one operation"""
......
...@@ -16,6 +16,9 @@ class ParseError(Exception): ...@@ -16,6 +16,9 @@ class ParseError(Exception):
'''Base exceptions from requests made to Parse''' '''Base exceptions from requests made to Parse'''
pass pass
class ParseBatchError(Exception):
''' Error in batching operation... should take a list. '''
pass
class ResourceRequestBadRequest(ParseError): class ResourceRequestBadRequest(ParseError):
'''Request returns a 400''' '''Request returns a 400'''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment