<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    +1 on specific exceptions. <br>
    <br>
    Not sure about Runtime vs. not runtime exceptions. <br>
    <br>
    +1 on Kris's comment about being able to attach the task or command
    or additional info to the exception. <br>
    <br>
    -1 on exception "codes": a message and maybe additional information
    is enough. <br>
    <br>
    Also, it would be nice to keep the exception throwing logic
    "centralized" -- that is, that we're not adding catch/throw logic
    all over the place but have only a few places where that happens.
    This helps track down bugs later. <br>
    <br>
    Thanks!<br>
    Marco<br>
    <br>
    11-05-12 08:38, Mauricio Salatino:
    <blockquote
cite="mid:CANzbnyXFDJjMp9oDXRb9yOGOiS9zS8c3FXaZSUAdEK+Do6nhOw@mail.gmail.com"
      type="cite">We don't need, but that was my initial question.&nbsp;
      <div>We wrap the Runtime Exception of the server and we propagate
        TaskException, which should not longer extends Runtime Exception
        and we add the Exception to the interface, or we keep using
        RuntimeExceptions&nbsp;
        <div>
          and strongly documents that the user will need to call all
          these methods in a try/catch block if they want to build real
          apps, which I believe that is not as good as the IDE forcing
          them to catch TaskExceptions.</div>
        <div>
          <br>
        </div>
        <div>I will definitely check the Script solution and then we
          will need to decide if documenting that is enough or we move
          the exception to the TaskService and AsyncTaskService
          interface.&nbsp;</div>
        <div><br>
        </div>
        <div>
          Cheers</div>
        <div><br>
          <br>
          <div class="gmail_quote">On Fri, May 11, 2012 at 9:31 AM, Kris
            Verlaenen <span dir="ltr">&lt;<a moz-do-not-send="true"
                href="mailto:kris.verlaenen@gmail.com" target="_blank">kris.verlaenen@gmail.com</a>&gt;</span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">Having a
              specific exception definitely would be useful, as it would<br>
              allow you to add context, like doing a getTask() or
              getCommand() or<br>
              whatever we believe is valid (as the user might not know
              anymore what<br>
              he asked). &nbsp;Note that we recently did something similar in
              master for<br>
              exceptions when executing a script, where we then add info
              about what<br>
              process instance etc.<br>
              <br>
              If TaskException extends RuntimeException, I suppose we
              don't really<br>
              have to declare it in the interfaces?<br>
              <span class="HOEnZb"><font color="#888888"><br>
                  Kris<br>
                </font></span>
              <div class="HOEnZb">
                <div class="h5"><br>
                  On Fri, May 11, 2012 at 2:05 PM, Mauricio Salatino
                  &lt;<a moz-do-not-send="true"
                    href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>&gt;
                  wrote:<br>
                  &gt;<br>
                  &gt;<br>
                  &gt; On Thu, May 10, 2012 at 4:20 PM, Mauricio
                  Salatino &lt;<a moz-do-not-send="true"
                    href="mailto:salaboy@gmail.com">salaboy@gmail.com</a>&gt;<br>
                  &gt; wrote:<br>
                  &gt;&gt;<br>
                  &gt;&gt; Hi guys,<br>
                  &gt;&gt; I was reviewing the Human Task Module and
                  more specifically the HornetQ<br>
                  &gt;&gt; implementation.<br>
                  &gt;&gt; I was writing some tests to check the
                  behavior after a logical failure in<br>
                  &gt;&gt; the server side and I reach a point where
                  some design questions appear:<br>
                  &gt;&gt;<br>
                  &gt;&gt; The following line tries to start a task
                  which doesn't exist in the<br>
                  &gt;&gt; server:<br>
                  &gt;&gt;<br>
                  &gt;&gt; client.start(3, "");<br>
                  &gt;&gt;<br>
                  &gt;&gt; Where client is -&gt;&nbsp;TaskService.<br>
                  &gt;&gt;<br>
                  &gt;&gt; This leads to a Runtime Exception in the
                  client side with a clear<br>
                  &gt;&gt; message:<br>
                  &gt;&gt; "Command OperationRequest faild due to No
                  Task with ID 3 was found!.<br>
                  &gt;&gt; Please contact task server administrator."
                  &nbsp;&lt;-- not sure about the<br>
                  &gt;&gt; administrator part<br>
                  &gt;&gt;<br>
                  &gt;&gt; I understand that we are throwing a Runtime
                  Exception to be able to not<br>
                  &gt;&gt; declare the exception inside the&nbsp;TaskService
                  interface, but...<br>
                  &gt;&gt; For real implementations the user will be
                  forced to do the following:<br>
                  &gt;&gt;<br>
                  &gt;&gt; &nbsp; &nbsp; &nbsp; try{<br>
                  &gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; client.start(3, "");<br>
                  &gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; }catch(Exception e){<br>
                  &gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; assertEquals("Command
                  OperationRequest faild due to No Task<br>
                  &gt;&gt; with ID 3 was found!. Please contact task
                  server administrator.",<br>
                  &gt;&gt; e.getMessage());<br>
                  &gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // or notify the UI about the
                  error using that message.<br>
                  &gt;&gt; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
                  &gt;&gt; No matter the method that the user calls in
                  the client UIs the try/catch<br>
                  &gt;&gt; block will need to be included in order to
                  not break the app.<br>
                  &gt;&gt; So my question is: we already have the
                  TaskException class which extends<br>
                  &gt;&gt; RuntimeException, there are not too many
                  implementations, but we surely can<br>
                  &gt;&gt; add<br>
                  &gt;&gt; the TaskPersistence exception, logical
                  exceptions, etc.<br>
                  &gt;&gt; In my perspective adding the exception to
                  both interfaces (TaskService and<br>
                  &gt;&gt; AsyncTaskService) will provide a more clear
                  approach to the users that in<br>
                  &gt;&gt; the end will<br>
                  &gt;&gt; need to add the try catch no matter why.<br>
                  &gt;&gt;<br>
                  &gt;&gt; In my opinion, this is just the first step of
                  providing our clients a way<br>
                  &gt;&gt; to notify the errors to their UIs.<br>
                  &gt;&gt;<br>
                  &gt;&gt; Looking forward for your comments and
                  feedback!<br>
                  &gt;&gt;<br>
                  &gt;&gt; Cheers<br>
                  &gt;&gt;<br>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
jBPM/Drools developer
Utrecht, the Netherlands</pre>
  </body>
</html>