メッセージに error.message や error.trace を連結して入れるのも手ですが、メッセージとしては読みづらく使いづらいです。 よってこれまでは、コード全体のエントリポイントなどでまとめてエラーをキャッチしスタックトレースが失われない形で処理するなどしていたかと思います。 Error の cause オプション ES2022 で入った機能で、このように Error の第二引数にオプションで cause を渡せるようになりました。
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く