Innovenergy_trunk/frontend/node_modules/p-finally/index.js

18 lines
222 B
JavaScript
Raw Normal View History

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