-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handling error in .saveAll() #188
Comments
It seems like you are hitting this particular situation because of what I posted here. I recommend choosing one of the options I mentioned. The try is throwing correctly:
If you want to submit a PR and attempt to identify the specific object that throws, I will review it, but attempting to save mixed environment custom objectId's isn't recommended and not supported by the SDK. |
Do you mean what you posted here, right? I will switch to server generated Ids as I have basically only one class that got custom objectId to save few cloud code queries. Therefore I believe this situation won't happen anymore as I see that Parse-Swift/Sources/ParseSwift/API/API+Commands.swift Lines 333 to 363 in fca7ab1
As mixed generated+custom objectId is not supported, do you think that such enhancement would be of any use? I believe we can close this topic, otherwise it would make more sense to support the mixed environment also? |
Yes
Posting my answer from here for future reference.
Feel free to close if you don't have any more questions. |
The label |
I am learning how to efficiently save objects in batch and how to properly handle the errors and I noticed that the code is throwing only one error it gets from the batch. Here is a simple example and I try to upload 2 objects that are not yet on the server - one with objectId = nil and other with defined objectId:
What is a bit confusing for me is that the
.success(let saveResults)
is also aResult
but the failure in that result seems to not be reached as the .saveAll() catch the failure according to lines:Parse-Swift/Sources/ParseSwift/Objects/ParseObject.swift
Lines 258 to 264 in fca7ab1
So in this example, because I use
allowCustomObjecId
the first object throws:But the second object does not throw anything as the function does not come to the second object. What makes sense, as it tries to construct command and gets stopped by following guard (although I am getting lost in the code so I might be wrong):
Parse-Swift/Sources/ParseSwift/API/API+Commands.swift
Lines 370 to 372 in fca7ab1
My question would be then... If the
.saveAll()
fails due to one object in array, how can I find out what object it was so that I could exclude it from repeated upload or show warning in the UI?The text was updated successfully, but these errors were encountered: