title: Handling exceptions by Reactor Spring
body: <p>I am using Reactor 2 and Spring 4.  Here's the typical code that I have - a <code>Consumer</code> working with a repository</p>
  
  <pre><code>@Consumer
  public class ApplicationService {
  
     @Selector(value="/applications/id", type = SelectorType.URI)
     @ReplyTo
     public Application byApplicationId(String id) throws ApplicationNotFoundException {
        Application app = appRepo.findOne(id);
        if(app == null) 
          throw new ApplicationNotFoundException("Application `" + id + "` could not be found.");
        return app;
     }
  }
  </code></pre>
  
  <p>Then I have a controller that passes the request to an <code>eventBus</code> into which I pass requests and return a <code>Promise</code></p>
  
  <pre><code>@RestController
  @RequestMapping("/applications")
  public class ApplicationsController {
     @RequestMapping(value = "/{id}", method = GET, produces = APPLICATION_JSON_VALUE)
     public Promise&lt;Event&lt;Application&gt;&gt; byApplicationId(@PathVariable final String id) {
        final Promise&lt;Event&lt;Application&gt;&gt; p = Promises.prepare(env);
        eventBus.sendAndReceive("/applications/id", Event.wrap(id), p);
        return p;
     }
  
  }
  </code></pre>
  
  <p>Things work but in case of <code>ApplicationService</code> throwing an exception <code>Promise</code>s value is not set but I do get following in the console:</p>
  
  <pre><code>16:46:58.003 [main] ERROR reactor.bus.EventBus - null
  java.lang.reflect.UndeclaredThrowableException
      at org.springframework.util.ReflectionUtils.rethrowRuntimeException(ReflectionUtils.java:302)
  ...
  Caused by: com.metlife.harmony.exceptions.ApplicationNotFoundException: Application `2860c555-0bc4-45e6-95ea-f724ae3f4464` could not be found.
      at com.metlife.harmony.services.ApplicationService.byApplicationId(ApplicationService.java:46) ~[classes/:?]
  ...
  Caused by: reactor.core.support.Exceptions$ValueCause: Exception while signaling value: reactor.bus.Event.class : Event{id=null, headers={}, replyTo=reactor.bus.selector.Selectors$AnonymousKey@4, key=/applications/id, data=2860c555-0bc4-45e6-95ea-f724ae3f4464}
  </code></pre>
  
  <p>Questions are:</p>
  
  <ol>
  <li><p>do I use Reactor and <code>eventBus</code> in the wrong way ? and if so, what is the right way</p></li>
  <li><p>perhaps this functionality is not implemented yet</p></li>
  </ol>