title: How to filter errors in a Bacon.js stream
body: <p>Sometimes I want to filter out certain errors in a stream. I'd like to write something like this:</p>
  
  <pre><code>stream
    .filterError (error) -&gt;
      error.type is 'foo'
  </code></pre>
  
  <p>But there is no <code>filterError</code> method.</p>
  
  <p>As an alternative I thought I could use <code>errors().mapError</code> to map the errors into values, filter them, and then map them back into errors. However, I don't see a way to convert a value in a stream into an error.</p>
  
  <pre><code># Filter only the errors we are interested in
  errors = stream.errors()
    .mapError (error) -&gt;
      error
    .filter (error) -&gt;
      ...
    .mapValuesBackIntoErrors() # ?    
  </code></pre>
  
  <p>The idea is that the stream in question either carries a value or an error. Both represent domain knowledge; the value means the system is in normal operation and the error means we have a domain error. Some of the domain errors are not such that we want to carry them, though, so I wish to filter them out.</p>