Package org.xwiki.rendering.util
Interface ErrorBlockGenerator
-
@Role public interface ErrorBlockGenerator
Generates error blocks to render an error in a wiki page.- Since:
- 8.1M1
- Version:
- $Id: c7f129f4a422a066803d141e322f5dbd4159daac $
-
-
Field Summary
Fields Modifier and Type Field Description static String
CLASS_ATTRIBUTE_DESCRIPTION_VALUE
The CSS class attribute value to use for the block displaying the description.static String
CLASS_ATTRIBUTE_MESSAGE_VALUE
The CSS class attribute value to use for the block displaying the message.static String
CLASS_ATTRIBUTE_NAME
The CSS class attribute name to use for the generated top level error block.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default boolean
containsError(Block block)
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.List<Block>
generateErrorBlocks(String message, String description, boolean isInline)
Deprecated.since 14.0RC1, usegenerateErrorBlocks(boolean, String, String, String, Object...)
insteadList<Block>
generateErrorBlocks(String messagePrefix, Throwable throwable, boolean isInline)
Deprecated.since 14.0RC1, usegenerateErrorBlocks(boolean, String, String, String, Object...)
instead
-
-
-
Field Detail
-
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:
- Constant Field Values
-
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:
- Constant Field Values
-
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:
- Constant Field Values
-
-
Method Detail
-
containsError
@Unstable 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)
Deprecated.since 14.0RC1, usegenerateErrorBlocks(boolean, String, String, String, Object...)
insteadGenerates error blocks to render an error in a wiki page.- Parameters:
message
- the short message that will be displayed to the userdescription
- the description that will be displayed to the user when he clicks on the messageisInline
- whether the generated blocks should be inline or not- Returns:
- the generated blocks
-
generateErrorBlocks
@Deprecated List<Block> generateErrorBlocks(String messagePrefix, Throwable throwable, boolean isInline)
Deprecated.since 14.0RC1, usegenerateErrorBlocks(boolean, String, String, String, Object...)
insteadGenerates 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 prefixthrowable
- the exception from which the description will be extracted fromisInline
- whether the generated blocks should be inline or not- Returns:
- the generated blocks
-
generateErrorBlocks
@Unstable 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 notmessageId
- 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'sLogger
syntaxdefaultDescription
- the default description following SLF4J'sLogger
syntaxarguments
- a list arguments to insert in the message and the description and/or aThrowable
- Returns:
- the generated blocks. Return a
XDOM
ifinline
is false. - Since:
- 14.0RC1
-
-