Display toast if folder observer fails (fixes #326).

This commit is contained in:
Felix Ableitner 2015-05-22 22:33:14 +02:00
parent c69b37bc5c
commit 2ed6dac071
2 changed files with 10 additions and 0 deletions

View File

@ -19,6 +19,7 @@ import android.preference.PreferenceManager;
import android.support.v4.app.NotificationCompat;
import android.util.Log;
import android.util.Pair;
import android.widget.Toast;
import com.nutomic.syncthingandroid.R;
import com.nutomic.syncthingandroid.activities.MainActivity;
@ -325,6 +326,12 @@ public class SyncthingService extends Service implements
mObservers.add(new FolderObserver(mApi, r));
} catch (FolderObserver.FolderNotExistingException e) {
Log.w(TAG, "Failed to add observer for folder", e);
} catch (StackOverflowError e) {
Log.w(TAG, "Failed to add folder observer", e);
Toast.makeText(SyncthingService.this,
R.string.toast_folder_observer_stack_overflow,
Toast.LENGTH_LONG)
.show();
}
}
}

View File

@ -393,6 +393,9 @@ Please report any problems you encounter via Github.</string>
<!-- Title of the notification shown while syncthing is running and enabled -->
<string name="syncthing_active">Syncthing is running</string>
<!-- Toast shown if folder observer fails to traverse a folder -->
<string name="toast_folder_observer_stack_overflow">Directory tree too deep. Check for cyclic symlinks</string>
<!-- RestApi -->