Finishing off my dropbox based app and trying to put in some comprehensive error code. Downloading thumbnails within it and crafted this method based on the documentation. Seems to work, but wanted to double check I am on the right track.
func doThumbError(error: Any) {
switch error as! CallError<SwiftyDropbox.Files.ThumbnailError> {
case .routeError(let boxed, let requestId):
switch boxed.unboxed {
case .conversionError: break
case .unsupportedExtension:break
case .unsupportedImage:break
case .path(let lookupError):
switch lookupError {
case .notFound:
print("There is nothing at the given path.")
break
case .notFile:
print("We were expecting a file, but the given path refers to something that isn't a file.")
break
case .notFolder:
print("We were expecting a folder, but the given path refers to something that isn't a folder.")
break
case .restrictedContent:
print("The file cannot be transferred because the content is restricted...")
break
case .malformedPath(let malformedPath):
print("Malformed path: \(malformedPath)")
break
default:
print("Unknown \(error)")
break
}
}
case .internalServerError(let code, let message, let requestId):
print("InternalServerError[\(requestId)]: \(code): \(message)")
break
case .badInputError(let message, let requestId):
print("BadInputError[\(requestId)]: \(message)")
break
case .authError(let authError, let requestId):
print("AuthError[\(requestId)]: \(authError)")
break
case .rateLimitError(let rateLimitError, let requestId):
print("RateLimitError[\(requestId)]: \(rateLimitError)")
break
case .httpError(let code, let message, let requestId):
print("HTTPError[\(requestId)]: \(code): \(message)")
break
case .clientError(let error):
print("ClientError: \(error)")
break
}
}