use of gherkin.ParserException in project cucable-plugin by trivago.
the class GherkinDocumentParser method getGherkinDocumentFromFeatureFileContent.
/**
* Get a {@link GherkinDocument} from a feature file for further processing.
*
* @param featureContent a feature string.
* @return a {@link GherkinDocument}.
* @throws CucablePluginException see {@link CucablePluginException}.
*/
private GherkinDocument getGherkinDocumentFromFeatureFileContent(final String featureContent) throws CucablePluginException {
Parser<GherkinDocument> gherkinDocumentParser = new Parser<>(new AstBuilder());
GherkinDocument gherkinDocument;
try {
gherkinDocument = gherkinDocumentParser.parse(featureContent);
} catch (ParserException parserException) {
throw new CucablePluginException("Could not parse feature!");
}
if (gherkinDocument == null || gherkinDocument.getFeature() == null) {
throw new CucablePluginException("Could not parse feature!");
}
return gherkinDocument;
}
use of gherkin.ParserException in project cucable-plugin by trivago.
the class GherkinDocumentParser method getGherkinDocumentFromFeatureFileContent.
/**
* Get a {@link GherkinDocument} from a feature file for further processing.
*
* @param featureContent a feature string.
* @return a {@link GherkinDocument}.
* @throws CucablePluginException see {@link CucablePluginException}.
*/
private GherkinDocument getGherkinDocumentFromFeatureFileContent(final String featureContent) throws CucablePluginException {
Parser<GherkinDocument> gherkinDocumentParser = new Parser<>(new AstBuilder());
GherkinDocument gherkinDocument;
try {
gherkinDocument = gherkinDocumentParser.parse(featureContent);
} catch (ParserException parserException) {
throw new CucablePluginException(parserException.getMessage());
}
if (gherkinDocument == null || gherkinDocument.getFeature() == null) {
cucableLogger.warn("No parsable gherkin.");
}
return gherkinDocument;
}
Aggregations