View Javadoc

1   package com.atlassian.johnson.support;
2   
3   import com.atlassian.johnson.event.Event;
4   
5   import javax.annotation.Nonnull;
6   import javax.annotation.Nullable;
7   
8   /**
9    * Describes a strategy for translating an exception to an {@link Event}.
10   *
11   * @since 3.0
12   */
13  public interface EventExceptionTranslator {
14  
15      /**
16       * Attempt to translate the provided {@code Throwable} to an {@link Event event}. Implementors may return
17       * {@code null} if an event should not be created, or to allow for chaining translators to handle specific
18       * cases separately.
19       *
20       * @param thrown the exception to translate
21       * @return an {@link Event event}, or {@code null} if the exception could not, or should not, be translated
22       */
23      @Nullable
24      Event translate(@Nonnull Throwable thrown);
25  }