Sometimes you want to log an error but let it propagate. Catch it, do your work, then throw it again.
try {
riskyOperation();
} catch (error) {
console.error("Error occurred:", error);
throw error; // Rethrow for caller to handle
}
This pattern is common in middleware and logging layers.