ソースを参照

Handle missing stacks

Manav Rathi 1 年間 前
コミット
b66972e884
1 ファイル変更1 行追加1 行削除
  1. 1 1
      web/packages/next/log.ts

+ 1 - 1
web/packages/next/log.ts

@@ -34,7 +34,7 @@ const messageWithError = (message: string, e?: unknown) => {
     if (e instanceof Error) {
     if (e instanceof Error) {
         // In practice, we expect ourselves to be called with Error objects, so
         // In practice, we expect ourselves to be called with Error objects, so
         // this is the happy path so to say.
         // this is the happy path so to say.
-        es = `${e.name}: ${e.message}\n${e.stack}`;
+        es = [`${e.name}: ${e.message}`, e.stack].filter((x) => x).join("\n");
     } else {
     } else {
         // For the rest rare cases, use the default string serialization of e.
         // For the rest rare cases, use the default string serialization of e.
         es = String(e);
         es = String(e);