Class DataSonnetErrorMessageFormatter
- All Implemented Interfaces:
IConfigurable, IErrorMessageFormatter, IScopeProvider, IWithParameters
.jsonnet JSON transformation file to the standard JSON error message generated by the ErrorMessageFormatter.
If the transformation does not succeed, this 'standard' error message is returned in JSON format and an exception is logged.
- Since:
- 9.2
- See Also:
- Parameters
- All parameters are added to the
.jsonnetstylesheet. Parameter names must be unique.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidConfigure this component.format(@Nullable String errorMessage, @Nullable Throwable t, @Nullable HasName location, @Nullable Message originalMessage, PipeLineSession session) Format the available parameters into an XML or JSON message.voidsetImports(String imports) List of stylesheets / DataSonnet files imported by the stylesheet to be executed.voidsetMessageFormat(DocumentFormat messageFormat) Format the error message as XML or as JSON.voidsetOutputFileFormat(DataSonnetOutputType outputType) Output file format.voidsetOutputType(DataSonnetOutputType outputType) Deprecated.voidsetStyleSheetName(String styleSheetName) Set a DataSonnet stylesheet to transform the default JSON error message to a custom format.Methods inherited from class ErrorMessageFormatter
getErrorMessage, getMessageAsStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IScopeProvider
getConfigurationClassLoader
-
Constructor Details
-
DataSonnetErrorMessageFormatter
public DataSonnetErrorMessageFormatter()
-
-
Method Details
-
configure
Description copied from interface:IConfigurableConfigure this component.configure()is called once at startup of the framework in the configure method of the owner of thisIConfigurable. Purpose of this method is to check whether the static configuration of the object is correct. As much as possible class-instantiating should take place in theconfigure(), to improve performance.In the case of a container, this will propagate the configure signal to all components that apply.
- Specified by:
configurein interfaceIConfigurable- Throws:
ConfigurationException- in case it was not able to configure the component.
-
format
public Message format(@Nullable String errorMessage, @Nullable Throwable t, @Nullable HasName location, @Nullable Message originalMessage, PipeLineSession session) Description copied from class:ErrorMessageFormatterFormat the available parameters into an XML or JSON message.
Override this method in subclasses to obtain the required behaviour.- Specified by:
formatin interfaceIErrorMessageFormatter- Overrides:
formatin classErrorMessageFormatter
-
setStyleSheetName
Set a DataSonnet stylesheet to transform the default JSON error message to a custom format. -
setOutputFileFormat
Output file format. DataSonnet is semi-capable of converting the converted JSON to a different format.- Default value
- JSON
-
setOutputType
@Deprecated @ConfigurationWarning("for documentation purposes we've renamed this field to [outputFileFormat]") public void setOutputType(DataSonnetOutputType outputType) Deprecated. -
setMessageFormat
Description copied from class:ErrorMessageFormatterFormat the error message as XML or as JSON.- Overrides:
setMessageFormatin classErrorMessageFormatter
-
addParameter
- Specified by:
addParameterin interfaceIWithParameters
-
getParameterList
- Specified by:
getParameterListin interfaceIWithParameters
-
setImports
List of stylesheets / DataSonnet files imported by the stylesheet to be executed. Stylesheets are only evaluated as JSonnet files if the filename has the extension .ds or .libsonnet.The list of stylesheets is expected to be a comma-separated list of files, which are loaded from the configuration. Import statements in DataSonnet cannot be used unless each file to be imported is listed here in the
importsattribute.Imported files may not be able to use DataSonnet functions from DataSonnet's own libraries, normally available as
ds.map()and the like. The cause for this is not yet known.
-