Search in sources :

Example 1 with DownloadErrorException

use of com.dropbox.core.v2.files.DownloadErrorException in project keepass2android by PhilippC.

the class DropboxV2Storage method convertException.

private Exception convertException(DbxException e) {
    Log.d(TAG, "Exception of type " + e.getClass().getName() + ":" + e.getMessage());
    if (InvalidAccessTokenException.class.isAssignableFrom(e.getClass())) {
        Log.d(TAG, "LoggedIn=false (due to InvalidAccessTokenException)");
        setLoggedIn(false);
        clearKeys();
        return new UserInteractionRequiredException("Unlinked from Dropbox! User must re-link.", e);
    }
    if (ListFolderErrorException.class.isAssignableFrom(e.getClass())) {
        ListFolderErrorException listFolderErrorException = (ListFolderErrorException) e;
        if (listFolderErrorException.errorValue.getPathValue().isNotFound())
            return new FileNotFoundException(e.toString());
    }
    if (DownloadErrorException.class.isAssignableFrom(e.getClass())) {
        DownloadErrorException downloadErrorException = (DownloadErrorException) e;
        if (downloadErrorException.errorValue.getPathValue().isNotFound())
            return new FileNotFoundException(e.toString());
    }
    if (GetMetadataErrorException.class.isAssignableFrom(e.getClass())) {
        GetMetadataErrorException getMetadataErrorException = (GetMetadataErrorException) e;
        if (getMetadataErrorException.errorValue.getPathValue().isNotFound())
            return new FileNotFoundException(e.toString());
    }
    if (DeleteErrorException.class.isAssignableFrom(e.getClass())) {
        DeleteErrorException deleteErrorException = (DeleteErrorException) e;
        if (deleteErrorException.errorValue.getPathLookupValue().isNotFound())
            return new FileNotFoundException(e.toString());
    }
    return e;
}
Also used : ListFolderErrorException(com.dropbox.core.v2.files.ListFolderErrorException) FileNotFoundException(java.io.FileNotFoundException) DeleteErrorException(com.dropbox.core.v2.files.DeleteErrorException) DownloadErrorException(com.dropbox.core.v2.files.DownloadErrorException) GetMetadataErrorException(com.dropbox.core.v2.files.GetMetadataErrorException)

Aggregations

DeleteErrorException (com.dropbox.core.v2.files.DeleteErrorException)1 DownloadErrorException (com.dropbox.core.v2.files.DownloadErrorException)1 GetMetadataErrorException (com.dropbox.core.v2.files.GetMetadataErrorException)1 ListFolderErrorException (com.dropbox.core.v2.files.ListFolderErrorException)1 FileNotFoundException (java.io.FileNotFoundException)1