You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
jimbobbles
4 months agoExplorer | Level 3
Figuring out what type of error in unboxed in SwiftyDropbox
I'm trying to understand how to catch and parse errors from the swifty dropbox SDK, specifically route errors. Apologies if this is a simple question, I'm new to Swift! In the examples that I've ...
Greg-DB
4 months agoDropbox Staff
The uploadSessionStartBatch method doesn't actually have a route specific error type, because it doesn't have any route specific errors. (It's just Void.) You can see this in the uploadSessionStartBatch documentation where it says:
Return Value
Through the response callback, the caller will receive a
Files.UploadSessionStartBatchResult
object on success or aVoid
object on failure.
For comparison, you can see how the listFolder documentation says:
Return Value
Through the response callback, the caller will receive a
Files.ListFolderResult
object on success or aFiles.ListFolderError
object on failure.
The uploadSessionStartBatch method itself doesn't upload or commit any data, and so doesn't consume any space in the user's account; that means it can't cause the user's account to go over quota and so can't trigger any over quota error for you to catch.
If you want to proactively check the user's space usage though, you can call getSpaceUsage.
- jimbobbles4 months agoExplorer | Level 3
Ah right, thank you. It looks like uploadSessionFinishBatchV2 also returns Void, which is surpirising because the Java version of uploadSessionFinishBatchV2 returns a WriteError.INSUFFICIENT_SPACE if there isn't enough space. Furthermore, uploadSessionAppendV2 returns an UploadSessionAppendError which has the following values:
- notFound
- incorrectOffset(_:)
- closed
- notClosed
- tooLarge
- concurrentSessionInvalidOffset
- concurrentSessionInvalidDataSize
- payloadTooLarge
- other
- contentHashMismatch
I don't see an insufficient space value, so I'm still not sure how to catch an insufficient space error during batch upload - any pointers would be highly appreciated. I'd rather not have to proactively check before each upload (I'm not sure how you could safely do that when uploading many files in parallel)
Thanks!
- Greg-DB4 months agoDropbox Staff
The Java SDK isn't inconsistent with the Swift SDK; it doesn't directly return a WriteError. The Java SDK uploadSessionFinishBatchV2 method returns UploadSessionFinishBatchResult which has an entries field which is a list of UploadSessionFinishBatchResultEntry each of which might be a failure, and if it is a failure it would be a UploadSessionFinishError, and in some cases might be a WriteError in particular. Check out the linked documentation for more information on how to check the types at check step of that process.
You would do the same in the Swift SDK. The UploadSessionFinishBatchResult has entries which is a list of UploadSessionFinishBatchResultEntry, each of which is success or failure, and if it's a failure the object indicates why it failed, and so on.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,885 PostsLatest Activity: 2 hours agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!