Open this example in the interactive library
Source code
const events = [];
try {
await Promise.reject(new Error("failed"));
} catch {
events.push("handled");
} finally {
events.push("cleanup");
}
console.log(events);
Sample output
[ 'handled', 'cleanup' ]
