org.springframework.batch.item.mail

## Class DefaultMailErrorHandler

- java.lang.Object
- - org.springframework.batch.item.mail.DefaultMailErrorHandler

- All Implemented Interfaces:
    MailErrorHandler

      public class DefaultMailErrorHandler
      extends java.lang.Object
      implements MailErrorHandler

  This `MailErrorHandler` implementation simply rethrows the exception it receives.
  Since:
    2.1
  Author:
    Dan Garrette, Dave Syer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultMailErrorHandler()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `handle(org.springframework.mail.MailMessage message, java.lang.Exception exception)` Wraps the input exception with a runtime `MailException`.
    `void` | `setMaxMessageLength(int maxMessageLength)` The limit for the size of message that will be copied to the exception message.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultMailErrorHandler

          public DefaultMailErrorHandler()

  - ### Method Detail

    - #### setMaxMessageLength

          public void setMaxMessageLength(int maxMessageLength)

      The limit for the size of message that will be copied to the exception message. Output will be truncated beyond that. Default value is 1024.
      Parameters:
        `maxMessageLength` - the maximum message length

    - #### handle

          public void handle(org.springframework.mail.MailMessage message,
                             java.lang.Exception exception)
                      throws org.springframework.mail.MailException

      Wraps the input exception with a runtime `MailException`. The exception message will contain the failed message (using toString).
      Specified by:
        `handle` in interface `MailErrorHandler`
      Parameters:
        `message` - a failed message
        `exception` - a MessagingException
      Throws:
        `org.springframework.mail.MailException` - a translation of the Exception
      See Also:
        `MailErrorHandler.handle(MailMessage, Exception)`