title: How do I handle exceptions in map() in an Observable in RxJava
body: <p>I want to do this: </p>
  
  <pre><code>Observable.just(bitmap)
              .map(new Func1&lt;Bitmap, File&gt;() {
                  @Override
                  public File call(Bitmap photoBitmap) {
  
                      //File creation throws IOException, 
                      //I just want it to hit the onError() inside subscribe()
  
                      File photoFile = new File(App.getAppContext().getCacheDir(), "userprofilepic_temp.jpg");
                      if(photoFile.isFile()) {//delete the file first if it exists otherwise the new file won't be created
                          photoFile.delete();
                      }
                      photoFile.createNewFile(); //saves the file in the cache dir
  
                      FileOutputStream fos = new FileOutputStream(photoFile);
                      photoBitmap.compress(Bitmap.CompressFormat.JPEG, 90, fos);//jpeg format
                      fos.close();
  
                      return photoFile;
  
                  }
              })
              .subscribe(//continue implementation...);
  </code></pre>
  
  <p>Basically in the <code>call()</code> method, it can throw exceptions. How can I make the Observer handle it in <code>onError()</code>. Or is this not the right way to think about this?</p>