title: RXSwift: Catch an error without emiting an element from the stream
body: <p>Ultimately I need a way to catch RXSwift errors without emitting another item to the stream, this doesn't seem possible with the current RX operators.</p>
  
  <p>Here's how my application works now:</p>
  
  <p>I have 3 layers:</p>
  
  <ul>
  <li>Service layer</li>
  <li>Local data layer</li>
  <li>Remote data layer</li>
  </ul>
  
  <p>The service layer acts as a bridge between the local and remote layers and is called directly by UI code.</p>
  
  <p>For each function provided in the service layer e.g. <code>getData() -&gt; Observable&lt;String&gt;</code> I need to do the following:</p>
  
  <ul>
  <li>Get the local data &amp; start a ticker counting from 0 upwards every second</li>
  <li>Get the data from the remote service</li>
  <li>The ticker should only complete when the remote service completes</li>
  <li>If the local service returns an error, it must be ignored and not emitted</li>
  <li>When the remote service completes, update the local data with the new data, if any</li>
  </ul>
  
  <p>I've gotten this far in a playground:</p>
  
  <p>The local data service:</p>
  
  <pre><code>let localService = Observable&lt;String&gt;.create { (observer) -&gt; Disposable in
      observer.onNext("Local result")
      observer.onCompleted()
      return Disposables.create()
  }.observeOn(MainScheduler.instance)
  </code></pre>
  
  <p>The remote data service:</p>
  
  <pre><code>let remoteService = Observable&lt;String&gt;.create { (observer) -&gt; Disposable in
      observer.onNext("Remote result")
      observer.onCompleted()
      return Disposables.create()
  }.observeOn(MainScheduler.instance).delay(5, scheduler: MainScheduler.instance)
  </code></pre>
  
  <p>The database updater service:</p>
  
  <pre><code>let databaseUpdaterService = Observable&lt;Void&gt;.empty().observeOn(MainScheduler.instance).delay(2, scheduler: MainScheduler.instance)
  let remoteAndDatabaseService = remoteService.do(onNext: { (value) in
      print("Database updating")
      _ = databaseUpdaterService.subscribe(onCompleted: {
          print("Database updated")
      })
  })
  </code></pre>
  
  <p>The time ticker:</p>
  
  <pre><code>let ticker = Observable&lt;Int&gt;.interval(1, scheduler: MainScheduler.instance).do(onNext: { (tick) in
      print("Ticker event: \(tick) seconds")
  }).takeUntil(remoteService)
  </code></pre>
  
  <p>The merged service:</p>
  
  <pre><code>let mergedService = Observable&lt;String&gt;.merge([localService, remoteAndDatabaseService])
  </code></pre>
  
  <p>Starting the ticker:</p>
  
  <pre><code>print("Ticker start")
  _ = ticker.subscribe(onError: { (error) in
      print("Ticker error")
  }, onCompleted: {
      print("Ticker completed")
  }, onDisposed: {
      print("Ticker disposed")
  })
  </code></pre>
  
  <p>Starting the service:</p>
  
  <pre><code>print("Service start")
  _ = mergedService.subscribe(onNext: { (value) in
      print("Service value: \(value)")
  }, onError: { (error) in
      print(error.localizedDescription)
  }, onCompleted: {
      print("Service completed")
  }, onDisposed: {
      print("Service disposed")
  })
  </code></pre>
  
  <p>For the happy path, this works perfectly.</p>
  
  <p>However, in the case where the localService calls an <code>onError</code> (if the local object doesn't exist for example) the merged stream terminates.</p>
  
  <p>I would like for the error to be swallowed up and for nothing to be emmitted by the stream for the localService.</p>
  
  <p>Currently the <code>catch</code> operators force you to emit another object instead of failing silently.</p>
  
  <p>Thanks in advance for the help.</p>