public MarkedYAMLException apply(MarkedYAMLException e, String yaml) throws IOException {
Mark problemMark = e.getProblemMark();
Optional<YamlLine> prevLine = getLine(yaml, problemMark.getLine() - 1);
Optional<YamlLine> line = getLine(problemMark.get_snippet(0, 100), 0);
if (prevLine.isPresent() && line.isPresent()) {
YamlLine prev = prevLine.get();
YamlLine current = line.get();
if (isIncorrectIndentation(prev, current)) {
return incorrectIndentationException(prev, current, e);
} else if (isItemOutsideSequence(prev, current)) {
return itemOutsideSequence(e);
}
}
return new YamlSyntaxErrorException(e.getMessage(), e);
}