'use strict';
module.exports = async (
promise,
onFinally = (() => {})
) => {
let value;
try {
value = await promise;
} catch (error) {
await onFinally();
throw error;
}
return value;
};