Permalink
Browse files

Show an error message instead of crashing if there is an issue downlo…

…ading from Dropbox
  • Loading branch information...
1 parent 5836545 commit 111ff4421e37d3bbbcb5f06927bd4188a14ba21b @matburt committed May 2, 2011
Showing with 10 additions and 1 deletion.
  1. +1 −0 res/values/strings.xml
  2. +9 −1 src/com/matburt/mobileorg/Synchronizers/DropboxSynchronizer.java
View
@@ -29,6 +29,7 @@
<string name="error_url_put_detail">An error occurred attempting to upload the url %1$s: %2$s</string>
<string name="error_opening_database">An error occurred attempting to create database. Check your storage settings in the preferences menu, and make sure your storage card is available</string>
<string name="error_url_put">An error occurred while attempting to put the URL %s</string>
+ <string name="dropbox_fetch_error">There was an issue reading the dropbox path %1$s: %2$s</string>
<string name="apg_not_found">APG not found</string>
<string name="apg_version_not_supported">APG version not supported</string>
<string name="view_as_document">View as document</string>
@@ -116,7 +116,15 @@ private String getRootPath() throws ReportableError {
public BufferedReader fetchOrgFile(String orgPath) throws NotFoundException, ReportableError {
Log.i(LT, "Downloading " + orgPath);
- FileDownload fd = api.getFileStream("dropbox", orgPath, null);
+ FileDownload fd;
+ try {
+ fd = api.getFileStream("dropbox", orgPath, null);
+ }
+ catch (Exception e) {
+ throw new ReportableError(
+ r.getString(R.string.dropbox_fetch_error, orgPath, e.toString()),
+ null);
+ }
Log.i(LT, "Finished downloading");
BufferedReader reader = new BufferedReader(new InputStreamReader(fd.is));
return reader;

0 comments on commit 111ff44

Please sign in to comment.