Add initThrowsErrors() (#2379)

* Add initThrowsErrors()

* Update mermaid.js

* Update mermaid.js
This commit is contained in:
Mindaugas Laganeckas 2022-04-19 17:21:10 +02:00 committed by GitHub
parent fb82a5be46
commit 473aced449
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -30,6 +30,18 @@ import utils from './utils';
* Renders the mermaid diagrams * Renders the mermaid diagrams
*/ */
const init = function () { const init = function () {
try {
initThrowsErrors();
} catch (e) {
log.warn('Syntax Error rendering');
log.warn(e);
if (this.parseError) {
this.parseError(e);
}
}
};
const initThrowsErrors = function () {
const conf = mermaidAPI.getConfig(); const conf = mermaidAPI.getConfig();
// console.log('Starting rendering diagrams (init) - mermaid.init', conf); // console.log('Starting rendering diagrams (init) - mermaid.init', conf);
let nodes; let nodes;
@ -109,7 +121,6 @@ const init = function () {
log.debug('Detected early reinit: ', init); log.debug('Detected early reinit: ', init);
} }
try {
mermaidAPI.render( mermaidAPI.render(
id, id,
txt, txt,
@ -122,13 +133,6 @@ const init = function () {
}, },
element element
); );
} catch (e) {
log.warn('Syntax Error rendering');
log.warn(e);
if (this.parseError) {
this.parseError(e);
}
}
} }
}; };