UNPKG

insomnia-plugin-valorant

Version:
31 lines 1.02 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.tryInOrderLabeled = exports.tryInOrder = void 0; async function tryInOrder(functions) { const errors = []; for (const func of functions) { try { return await func(); } catch (e) { errors.push(e); } } throw errors; } exports.tryInOrder = tryInOrder; async function tryInOrderLabeled(functions) { const errors = []; for (const { label, func } of functions) { try { return await func(); } catch (e) { errors.push({ label, error: e }); } } throw `Error${functions.length === 1 ? '' : 's'} when running ${functions.length} function${functions.length === 1 ? '' : 's'}:\n\n` + errors.map(e => `Error when running "${e.label}":\n ${e.error.toString().split('\n').join('\n ')}`).join('\n\n'); } exports.tryInOrderLabeled = tryInOrderLabeled; //# sourceMappingURL=try-in-order.js.map