You can use try/finally without catch. The error still propagates up, but your cleanup code runs first.
function process() {
try {
doWork();
} finally {
cleanup(); // Runs before error propagates
}
}
This pattern ensures cleanup happens even when you want errors to bubble up.