Uploaded image for project: 'James Server'
  1. James Server
  2. JAMES-2275

Allow per Exception error handling in the mailet pipeline



      In JAMES-2271 from Taro App, the error handling system of the mailet pipeline can now be customized using the onMailetException property. This allows specifying the processor for error handling or ignore the error (by default error processor is triggered).

      While empowering the user to write custom error handling logic, the error handling code capabilities is limited as the original exception is lost along the way.

      We should:

      • Pass the Exception along with the Mail, as an attribute.

      Thus mailet in the error processor can access and read it. Throwable being serializable, this makes this change easy to perform.

      • Implement specific error handling matchers:
      • HasException would allow to see if a Mail has a specific exception
      <mailet match="HasException=org.apache.james.managesieve.api.ManageSieveException" class="...>
          1. How to implement this

      1. Add a ERROR_ATTRIBUTE_NAME contant in the Mail interface
      2. ProcessorUtil:: handleException should add the ERROR_ATTRIBUTE_NAME attriute using the provided exception
      3. Modify AbstractStateMailetProcessorTest to demonstrate that when a mailet or a matcher throws, the Exception is attahed to the incoming mail.

      4. In the mailet/standard project, you will implement the HasException matcher. You can extend GenericMatcher and implement unit tests for your class.


          Issue Links



              • Assignee:
                BTellier Tellier Benoit
              • Votes:
                0 Vote for this issue
                2 Start watching this issue


                • Created: