dropbox-sdk-js: API inconsistency: "filesDownload" returns an error as a string instead of an object
Version: “dropbox”: “^5.1.0”
If I provide a wrong path structure to filesDownload, Dropbox throws path/malformed_path/.. error.
The problem is that this error object provides data in a serialized (string) format and not as an object:

This makes it more difficult to handle an error.
In contrast, filesUpload returns the same error as an object:

It looks like somewhere in filesDownload there is an issue with JSON.stringify(…)/JSON.parse(…).
Please, make it consistent as an object.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 15 (8 by maintainers)
Commits related to this issue
- Change error response handling to jsonify error - Fix for [#278](https://github.com/dropbox/dropbox-sdk-js/issues/278) — committed to dropbox/dropbox-sdk-js by rogebrd 4 years ago
- Change error response handling to jsonify error - Fix for [#278](https://github.com/dropbox/dropbox-sdk-js/issues/278) — committed to dropbox/dropbox-sdk-js by rogebrd 4 years ago
- Change error response handling to jsonify error (#406) * Change error response handling to jsonify error - Fix for [#278](https://github.com/dropbox/dropbox-sdk-js/issues/278) — committed to dropbox/dropbox-sdk-js by rogebrd 4 years ago
Thanks for the report! I’ll ask the team to fix this up.
Hello, I am able to reproduce this issue but am unable to reproduce the desired outcome you said you were unable to achieve with
filesUpload.The sample code I used looks like this:
And the output looks like this:
As you can see both return a string type. While I can make the change to have these return a JSON object, I am trying to see how you were able to get upload to return an object. Could you paste some code snippets?
Similar issue after fixing https://github.com/dropbox/dropbox-sdk-js/issues/336 / https://github.com/dropbox/dropbox-sdk-js/issues/336. Error message is stringified instead of being an easy-to-use object: