Also fix for error handling when setting mermaid.parseError

This commit is contained in:
Knut Sveidqvist
2020-06-06 12:42:35 +02:00
parent 22b0ddfb42
commit 85a8feec9d
24 changed files with 783 additions and 772 deletions

View File

@@ -285,11 +285,11 @@ export const draw = function(text, id) {
parser.yy = flowDb;
// Parse the graph definition
try {
// try {
parser.parse(text);
} catch (err) {
logger.debug('Parsing failed');
}
// } catch (err) {
// logger.debug('Parsing failed');
// }
// Fetch the default direction, use TD if none was found
let dir = flowDb.getDirection();

View File

@@ -247,12 +247,16 @@ export const addEdges = function(edges, g) {
export const getClasses = function(text) {
logger.info('Extracting classes');
flowDb.clear();
const parser = flow.parser;
parser.yy = flowDb;
try {
const parser = flow.parser;
parser.yy = flowDb;
// Parse the graph definition
parser.parse(text);
return flowDb.getClasses();
// Parse the graph definition
parser.parse(text);
return flowDb.getClasses();
} catch (e) {
return;
}
};
/**
@@ -267,11 +271,11 @@ export const draw = function(text, id) {
parser.yy = flowDb;
// Parse the graph definition
try {
// try {
parser.parse(text);
} catch (err) {
logger.debug('Parsing failed');
}
// } catch (err) {
// logger.debug('Parsing failed');
// }
// Fetch the default direction, use TD if none was found
let dir = flowDb.getDirection();