From b4618f9ba1442d077caa7d99ae46466b40d65887 Mon Sep 17 00:00:00 2001 From: rhysd Date: Sun, 30 Apr 2023 22:29:53 +0900 Subject: [PATCH] Throw error when detecting diagram type failed and `suppressErrorRendering` is set --- packages/mermaid/src/mermaidAPI.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/mermaid/src/mermaidAPI.ts b/packages/mermaid/src/mermaidAPI.ts index b31378ce6..16421ba9b 100644 --- a/packages/mermaid/src/mermaidAPI.ts +++ b/packages/mermaid/src/mermaidAPI.ts @@ -476,6 +476,9 @@ const render = async function ( try { diag = await getDiagramFromText(text); } catch (error) { + if (config.suppressErrorRendering) { + throw error; + } diag = new Diagram('error'); parseEncounteredException = error; }