Interface ErrorBlockGenerator


@Role public interface ErrorBlockGenerator
Generates error blocks to render an error in a wiki page.
Since:
8.1M1
Version:
$Id: e42dd3ce7dc4f7b0b97f789649aa9d8228ff7532 $
  • Field Details

    • CLASS_ATTRIBUTE_NAME

      static final String CLASS_ATTRIBUTE_NAME
      The CSS class attribute name to use for the generated top level error block.
      See Also:
    • CLASS_ATTRIBUTE_MESSAGE_VALUE

      static final String CLASS_ATTRIBUTE_MESSAGE_VALUE
      The CSS class attribute value to use for the block displaying the message.
      See Also:
    • CLASS_ATTRIBUTE_DESCRIPTION_VALUE

      static final String CLASS_ATTRIBUTE_DESCRIPTION_VALUE
      The CSS class attribute value to use for the block displaying the description.
      See Also:
  • Method Details

    • containsError

      default boolean containsError(Block block)
      Parameters:
      block - the block in which to search for rendering errors
      Returns:
      true if the passed block contains a rendering error, false otherwise
      Since:
      14.0RC1
    • generateErrorBlocks

      @Deprecated List<Block> generateErrorBlocks(String message, String description, boolean isInline)
      Generates error blocks to render an error in a wiki page.
      Parameters:
      message - the short message that will be displayed to the user
      description - the description that will be displayed to the user when he clicks on the message
      isInline - whether the generated blocks should be inline or not
      Returns:
      the generated blocks
    • generateErrorBlocks

      @Deprecated List<Block> generateErrorBlocks(String messagePrefix, Throwable throwable, boolean isInline)
      Generates error blocks to render an error in a wiki page.

      It's generally recommended to also provide a translation key to let the ErrorBlockGenerator implementation search for a localized version of the error message depending on the context locale.

      Parameters:
      messagePrefix - the prefix of the short message that will be displayed to the user. This message will be augmented with the root cause of the error extracted from the passed throwable and an additional text inviting the user to click the message will be added to the message prefix
      throwable - the exception from which the description will be extracted from
      isInline - whether the generated blocks should be inline or not
      Returns:
      the generated blocks
    • generateErrorBlocks

      default List<Block> generateErrorBlocks(boolean inline, String messageId, String defaultMessage, String defaultDescription, Object... arguments)
      Generates error blocks to render an error in a wiki page.

      If a TranslationMarker is provided, this message and description can be translated based on the current context depending on the implementation of this component.

      Parameters:
      inline - whether the generated blocks should be inline or not
      messageId - an identifier associated to the message. It's generally used, among other things, to find a translation for the message and the description in implementation which supports it.
      defaultMessage - the default message following SLF4J's Logger syntax
      defaultDescription - the default description following SLF4J's Logger syntax
      arguments - a list arguments to insert in the message and the description and/or a Throwable
      Returns:
      the generated blocks. Return a XDOM if inline is false.
      Since:
      14.0RC1