Class ErrorMessageBuilder
- java.lang.Object
-
- com.exasol.errorreporting.ErrorMessageBuilder
-
public class ErrorMessageBuilder extends Object
Builder for Exasol error messages.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ErrorMessageBuildermessage(String message, Object... arguments)Format a given message pattern with placeholders, filling them with the arguments passed in the specified form.ErrorMessageBuildermitigation(String mitigation, Object... arguments)Add a mitigation.ErrorMessageBuilderparameter(String placeholder, Object value)Add a parameter.ErrorMessageBuilderparameter(String placeholder, Object value, String description)Add a parameter.ErrorMessageBuilderticketMitigation()Add a mitigation for cases in which the only thing a user can do is opening a ticket.StringtoString()Build the error message.ErrorMessageBuilderunquotedParameter(String placeholder, Object value)Deprecated, for removal: This API element is subject to removal in a future version.As of release 3.0.0ErrorMessageBuilderunquotedParameter(String placeholder, Object value, String description)Deprecated, for removal: This API element is subject to removal in a future version.As of release 3.0.0
-
-
-
Method Detail
-
message
public ErrorMessageBuilder message(String message, Object... arguments)
Format a given message pattern with placeholders, filling them with the arguments passed in the specified form.Placeholders are defined in the message pattern by using double curly brackets
{{}}. By default, arguments are formatted with simple quotes unless specified other wise with the 'unquoted' format, defined by{{|uq}}.You should always define names in the placeholders. This name will be shown in case no argument is missing, by
{{argumentName}}or{{argumentName|uq}}.Below you can find examples on how to use it.
Example for quoted arguments:
ErrorMessageBuilder("ERROR_CODE").message("Message with {{namedQuotedArgument}}, {{}} and {{missingQuotedArgument}}, "named", "unnamed")returns "ERROR_CODE: Message with 'named', 'unnamed' and UNKNOWN PLACEHOLDER('anotherQuotedArgument')".
Example for unquoted arguments:
ErrorMessageBuilder("ERROR_CODE").message("Message with {{namedUnquotedArgument|uq}}, {{|uq}} and {{missingUnquotedArgument|uq}}, "named", "unnamed")returns "ERROR_CODE: Message with named, unnamed and UNKNOWN PLACEHOLDER('anotherQuotedArgument')".
- Parameters:
message- message that may contain placeholdersarguments- arguments to fill the placeholders- Returns:
- self for fluent programming
-
parameter
public ErrorMessageBuilder parameter(String placeholder, Object value)
Add a parameter. This method quotes the parameter.You can use the parameter in message and mitigation using
{{parameter}}.- Parameters:
placeholder- placeholder without parenthesesvalue- value to insert- Returns:
- self for fluent programming
-
parameter
public ErrorMessageBuilder parameter(String placeholder, Object value, String description)
Add a parameter.You can use the parameter in message and mitigation using
{{parameter}}.- Parameters:
placeholder- placeholder without parenthesesvalue- value to insertdescription- description for the error catalog- Returns:
- self for fluent programming
-
unquotedParameter
@Deprecated(since="3.0.0", forRemoval=true) public ErrorMessageBuilder unquotedParameter(String placeholder, Object value)
Deprecated, for removal: This API element is subject to removal in a future version.As of release 3.0.0Add a parameter without quotes.This method is deprecated. You can define that a parameter is unquoted by adding '|uq' to its correspondent placeholder. For more information, see
message(String, Object...).- Parameters:
placeholder- placeholder without parenthesesvalue- value to insert- Returns:
- self for fluent programming
-
unquotedParameter
@Deprecated(since="3.0.0", forRemoval=true) public ErrorMessageBuilder unquotedParameter(String placeholder, Object value, String description)
Deprecated, for removal: This API element is subject to removal in a future version.As of release 3.0.0Add a parameter without quotes.This method is deprecated. You can define that a parameter is unquoted by adding '|uq' to its correspondent placeholder. For more information, see
message(String, Object...).- Parameters:
placeholder- placeholder without parenthesesvalue- value to insertdescription- description for the error catalog- Returns:
- self for fluent programming
-
mitigation
public ErrorMessageBuilder mitigation(String mitigation, Object... arguments)
Add a mitigation. Explain here what users can do to resolve or avoid this error.For learning about the format rules, see
message(String, Object...).- Parameters:
mitigation- mitigation message that may contain placeholdersarguments- arguments to fill the placeholders- Returns:
- self for fluent programming
-
ticketMitigation
public ErrorMessageBuilder ticketMitigation()
Add a mitigation for cases in which the only thing a user can do is opening a ticket.- Returns:
- self for fluent programming
-
-