Skip to content

Commit

Permalink
#3395 Fix for lopp stopping at first failure
Browse files Browse the repository at this point in the history
  • Loading branch information
knsv committed Sep 2, 2022
1 parent f4a99fc commit 98f37d6
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/mermaid.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ const init = function () {
} catch (e) {
log.warn('Syntax Error rendering');
log.warn(e.str);
if (this.parseError) {
this.parseError(e);
}
}
};

Expand Down Expand Up @@ -93,8 +90,10 @@ const initThrowsErrors = function () {
const idGenerator = new utils.initIdGenerator(conf.deterministicIds, conf.deterministicIDSeed);

let txt;
const errors = [];

for (let i = 0; i < nodes.length; i++) {
log.info('Rendering diagram: ' + nodes[i].id, i);
// element is the current div with mermaid class
const element = nodes[i];

Expand Down Expand Up @@ -134,10 +133,16 @@ const initThrowsErrors = function () {
element
);
} catch (error) {
log.warn('Catching Error (bootstrap)');
throw { error, message: error.str };
log.warn('Catching Error (bootstrap)', error);
if (typeof mermaid.parseError === 'function') {
mermaid.parseError({ error, str: error.str, hash: error.hash, message: error.str });
}
errors.push({ error, str: error.str, hash: error.hash, message: error.str });
}
}
if (errors.length > 0) {
throw errors[0];
}
};

const initialize = function (config) {
Expand Down

0 comments on commit 98f37d6

Please sign in to comment.