@Override public String getErrorDescription() { if (yaml == null) { return "Cannot parse the yaml file: " + e.getProblem(); } return "Cannot parse the <strong>" + yaml.relativePath() + "</strong> file: " + e.getProblem(); }
@Override public void reconcile(IDocument doc, IProblemCollector problemCollector) { problemCollector.beginCollecting(); try { YamlFileAST ast = parser.getAST(doc); YamlASTReconciler reconciler = getASTReconciler(doc, problemCollector); if (reconciler!=null) { reconciler.reconcile(ast); } } catch (ParserException e) { String msg = e.getProblem(); Mark mark = e.getProblemMark(); problemCollector.accept(syntaxError(msg, mark.getIndex(), 1)); } catch (ScannerException e) { String msg = e.getProblem(); Mark mark = e.getProblemMark(); problemCollector.accept(syntaxError(msg, mark.getIndex(), 1)); } catch (Exception e) { logger.error("unexpected error during reconcile", e); } finally { problemCollector.endCollecting(); } }
public YAMLParserException interpret(ScannerException e) { String scalarScanning = "while scanning a plain scalar"; if (e.getContext() != null && e.getContext().matches(scalarScanning)) { String unexpected = "found unexpected ':'"; if (e.getProblem().matches(unexpected)) { String msg = "Using \":\" in values in flow context is invalid \n" + "Put all names (especially URIs) in parentheses. \n\n" + "(Example INVALID: { get_operation_output: [ SELF, http://www.example.com/interface/lifecycle, " + "operationName, outputName ] })\n" + "(Example VALID: { get_operation_output: [ SELF, \"http://www.example.com/interface/lifecycle\", " + "operationName, outputName ] })\n\n" + e.getMessage(); return new InvalidYamlSyntax(msg); } } return new InvalidYamlSyntax(e.toString()); } }