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 seen (for example here), a route error is unboxed and then cast to a specific error type like this:
case .routeError(let boxed, let requestId, nil, nil):
switch boxed.unboxed as Files.ListFolderError {
case .path(let lookupError):
...
What I'm struggling to understand is how do you know what type boxed.unboxed should be (in this case it was files.ListFolderError)?
For example, for the uploadSessionStartBatch route, I have the following code - what kind of route error does uploadSessionStartBatch return? How do I find this out? I'm trying to cast it to a type which I can parse to detect if the user is out of space.
do {
let uploadSessionStartBatchResult = try await client.files.uploadSessionStartBatch(
numSessions: UInt64(filePaths.count), sessionType: .concurrent).response()
}
catch {
switch error as? CallError<Any> {
case .routeError(let error, let userMessage, let errorSummary, let requestId):
switch error.unboxed as Files.???? {
// e.g. catch insufficient space error
}
}
}
Thanks so much!