πŸ”— Error.cause β€” don't lose the root cause when you rethrow

loadUser() calls fetchJSON() calls parse() β€” a real SyntaxError is thrown three layers down. Toggle whether each catch block rethrows with or without { cause: err }, then trigger the failure and watch how much of the original error survives to the top.

1 Call stack + rethrow style
Each catch block will
2 What each catch block actually runs

This is the same pattern at both fetchJSON's and loadUser's catch blocks β€” only the { cause: err } option changes.

3 Error chain received by the caller
Ready β€” click "Trigger the failure" above.

No error yet. Trigger the failure to see what the top-level catch receives.

The chain shows every error the top-level catch can reach by walking .cause.