From 60b3bc34cb07b5bec87cbd667ea9f804ff14cf3c Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Sun, 22 Oct 2023 04:06:02 +0000
Subject: [PATCH] fix: catch html to jsx errors (closes #547)
---
quartz/util/trace.ts | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/quartz/util/trace.ts b/quartz/util/trace.ts
index c7f3cc3..a33135d 100644
--- a/quartz/util/trace.ts
+++ b/quartz/util/trace.ts
@@ -4,7 +4,7 @@
const rootFile = /.*at file:/
export function trace(msg: string, err: Error) {
- const stack = err.stack
+ let stack = err.stack ?? ""
const lines: string[] = []
@@ -12,15 +12,11 @@
lines.push(
"\n" +
chalk.bgRed.black.bold(" ERROR ") +
- "\n" +
+ "\n\n" +
chalk.red(` ${msg}`) +
(err.message.length > 0 ? `: ${err.message}` : ""),
)
- if (!stack) {
- return
- }
-
let reachedEndOfLegibleTrace = false
for (const line of stack.split("\n").slice(1)) {
if (reachedEndOfLegibleTrace) {
--
Gitblit v1.10.0