use of org.mule.runtime.core.api.exception.DisjunctiveErrorTypeMatcher in project mule by mulesoft.
the class TemplateOnErrorHandler method createErrorType.
public static ErrorTypeMatcher createErrorType(ErrorTypeRepository errorTypeRepository, String errorTypeNames) {
if (errorTypeNames == null) {
return null;
}
String[] errorTypeIdentifiers = errorTypeNames.split(",");
List<ErrorTypeMatcher> matchers = stream(errorTypeIdentifiers).map((identifier) -> {
String parsedIdentifier = identifier.trim();
return new SingleErrorTypeMatcher(errorTypeRepository.lookupErrorType(buildFromStringRepresentation(parsedIdentifier)).orElseThrow(() -> new MuleRuntimeException(createStaticMessage("Could not find ErrorType for the given identifier: '%s'", parsedIdentifier))));
}).collect(toList());
return new DisjunctiveErrorTypeMatcher(matchers);
}
Aggregations