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: e42dd3ce7dc4f7b0b97f789649aa9d8228ff7532 $
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe CSS class attribute value to use for the block displaying the description.static final StringThe CSS class attribute value to use for the block displaying the message.static final StringThe CSS class attribute name to use for the generated top level error block. -
Method Summary
Modifier and TypeMethodDescriptiondefault booleancontainsError(Block block) generateErrorBlocks(boolean inline, String messageId, String defaultMessage, String defaultDescription, Object... arguments) Generates error blocks to render an error in a wiki page.generateErrorBlocks(String message, String description, boolean isInline) Deprecated.generateErrorBlocks(String messagePrefix, Throwable throwable, boolean isInline) Deprecated.since 14.0RC1, usegenerateErrorBlocks(boolean, String, String, String, Object...)instead
-
Field Details
-
CLASS_ATTRIBUTE_NAME
The CSS class attribute name to use for the generated top level error block.- See Also:
-
CLASS_ATTRIBUTE_MESSAGE_VALUE
The CSS class attribute value to use for the block displaying the message.- See Also:
-
CLASS_ATTRIBUTE_DESCRIPTION_VALUE
The CSS class attribute value to use for the block displaying the description.- See Also:
-
-
Method Details
-
containsError
- 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.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
ErrorBlockGeneratorimplementation 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
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
TranslationMarkeris 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'sLoggersyntaxdefaultDescription- the default description following SLF4J'sLoggersyntaxarguments- a list arguments to insert in the message and the description and/or aThrowable- Returns:
- the generated blocks. Return a
XDOMifinlineis false. - Since:
- 14.0RC1
-
generateErrorBlocks(boolean, String, String, String, Object...)instead