BACKEND·중요도 7·2026. 07. 21.·Dev.to
You're rethrowing errors and losing context. `Error.cause` fixes that.
── KO ──────────────────
에러 재처리에 대한 문제와 해결책을 제시하는 글입니다.
에러 처리에는 조용한 문제가 있으며, 에러를 호출 스택 깊이에서 포착하고 다른 것으로 래핑하면서 원래의 컨텍스트를 잃게 됩니다. 이 글은 `Error.cause`를 사용하여 이런 문제를 어떻게 해결할 수 있는지에 대해 설명합니다. `Error.cause`는 원래 에러에 대한 정보를 유지시키며, 에러의 원인을 더 명확히 이해할 수 있도록 도와줍니다.
── EN ──────────────────
The article addresses issues with rethrowing errors and how `Error.cause` resolves them.
Error handling has a subtle issue where catching an error deep in the call stack and wrapping it causes the loss of the original context. This article discusses how to fix this problem using `Error.cause`. It helps maintain information about the original error, enabling clearer understanding of the underlying causes.