JavaScript·Advanced·Conceptual·1 min read
How do you preserve a stack or cause when translating errors?
Short interview answer
Throw a domain error with the original error in its cause property, adding useful operation context without discarding the underlying diagnostic information.
Key takeaway
Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.