3 Replies Latest reply on Apr 4, 2011 9:55 AM by cbrock

    How to throw an exception to the client?

    m4chu

      Hi,

      I have a service where an object in the costructor throws an exception. How do I notify this exception to the client?

      In general, what is the best way to notify an exception to a client?

       

      example:

       

      @Service
      public class HelloWorldService implements MessageCallback {
      private MessageBus bus;
      
      @Inject
      public HelloWorldService(MessageBus bus){
           this.bus = bus;
           MyObject mo = new MyObject(); //this throws an exception
      
      }
      ...
      

       

      Another example where the exception is thrown in the callback method by an object:

       

       

      public void callback(Message message) {
           MyObject mo = new MyObject(); //this throws an exception
      }