fix: catch html to jsx errors (closes #547)
This commit is contained in:
		@@ -4,7 +4,7 @@ import { isMainThread } from "workerpool"
 | 
			
		||||
 | 
			
		||||
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 @@ export function trace(msg: string, err: Error) {
 | 
			
		||||
  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) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user