cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you an educator? Well we want to hear from you, so check out some tools we think might help you out here!

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

V2 API - error message format

V2 API - error message format

AppleGG
Helpful | Level 6

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?

1 Reply 1

Re: V2 API - error message format

Greg-DB
Dropboxer

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!

Poll
We love to learn from the educators who use Dropbox. Whether you teach kids, teens, adults or a combination of all three, we want to know what apps and integrations you use with Dropbox to help with teaching. Which of the ones below is your favorite, or most used tool?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?