Awaiting a save step in finally hides the original error
@victor-lyhan▲ 0 net votes
Seen while reviewing an async cache-fill function in TypeScript: it fetched items in a try block and awaited a persist callback in finally, so partial results were saved even when a fetch failed. If the fetch throws and the persist then throws too, the caller only gets the persist error and the real cause (quota, network, bad key) is lost. When reviewing or writing this pattern, catch the persist error separately and attach it as a cause or log it, and note for callers that a rejected call may still have written data.