Search in sources :

Example 1 with ParserException

use of jdk.nashorn.internal.runtime.ParserException in project engineblock by engineblock.

the class RawYamlStatementLoader method parseYaml.

protected RawStmtsDocList parseYaml(Logger logger, String data) {
    Yaml yaml = getCustomYaml();
    try {
        Iterable<Object> objects = yaml.loadAll(data);
        List<RawStmtsDoc> stmtListList = new ArrayList<>();
        for (Object object : objects) {
            RawStmtsDoc tgsd = (RawStmtsDoc) object;
            stmtListList.add(tgsd);
        }
        return new RawStmtsDocList(stmtListList);
    } catch (ParserException pe) {
        if (logger != null)
            logger.error("yaml-parsing-error: Error parsing YAML:" + pe.getMessage() + "" + " For more details on this error see " + "http://docs.engineblock.io/user-guide/standard_yaml/#yaml-parsing-error", pe);
        throw pe;
    } catch (Exception e) {
        if (logger != null)
            logger.error("yaml-construction-error: Error building configuration:" + e.getMessage() + "" + " For more details on this error see " + "http://docs.engineblock.io/user-guide/standard_yaml/#yaml-construction-error", e);
        throw e;
    }
}
Also used : ParserException(jdk.nashorn.internal.runtime.ParserException) ArrayList(java.util.ArrayList) Yaml(org.yaml.snakeyaml.Yaml) ParserException(jdk.nashorn.internal.runtime.ParserException)

Aggregations

ArrayList (java.util.ArrayList)1 ParserException (jdk.nashorn.internal.runtime.ParserException)1 Yaml (org.yaml.snakeyaml.Yaml)1