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!