Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Objective C DBRoulette PhotoViewController.m "downloadImage".
Handling of DBFILESDownloadError creates message strings using "routeError" without appending ".path", in contrast with that shown in "randomPhotoButtonPressed". I realize that these are two different errors. However, the relevant header files say to test "isPath" before accessing such, and "routeError" is an NSObject that has a "path" property. Why doesn't this append the ".path"? Is that a bug? Or is that somehow related to the statement about routeError being a union of some type?
For reference, that second parameter to the response block for any given API call is referred to as a "route error", because it is specific to the route. (Whereas the DBRequestError is not specific to the route.)
Each of these errors are a "union" meaning any particular instance of them will be one of a set of values allowed for that type. There's more information in the "Handling responses and errors" section of the readme.
For listFolder, the route error is an instance of DBFILESListFolderError. For the download calls, such as downloadData, the route error is an instance of DBFILESDownloadError.
Those different types can different properties. You can drill in to the different ones using the relevant methods/fields. The "is" methods let you check the value of the union instance, while the fields, e.g., "path", let you get the actual value, as shown in the sample:
- Calling isPath on DBFILESListFolderError
- Calling isPath on DBFILESDownloadError
There may be some overlap between any two, such as in this case where they happen to have the same properties.
Exactly how you handle the errors in your app is up to you. In the DBRoulette example, you're right that the listFolder error handling yields the error's path value itself, while the downloadData error handling yields the error itself only. It would probably be better to give the path error there, like with listFolder, so I'll ask the team to update that. Thanks!
Hi there!
If you need more help you can view your support options (expected response time for a 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!