Skip to content

Commit

Permalink
Handle FileNotFoundException
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelbcr committed Jan 25, 2017
1 parent 1218cd3 commit 0656cbc
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import android.support.annotation.Nullable;
import java.io.File;
import rx.Observable;
import rx.exceptions.Exceptions;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
import rx_activity_result.OnPreResult;
Expand Down Expand Up @@ -66,6 +68,11 @@ public Observable<String> response(int responseCode, @Nullable final Intent inte
intent.setData(Uri.fromFile(new File(filePath)));
return filePath;
}
})
.onErrorResumeNext(new Func1<Throwable, Observable<? extends String>>() {
@Override public Observable<? extends String> call(Throwable throwable) {
return Observable.just("");
}
});
} else {
return Observable.just("");
Expand Down

0 comments on commit 0656cbc

Please sign in to comment.