Continue when one request fails
Promise.all stops at the first failure. allSettled gives you every result.
AJAX · Continue when one request failsIntermediate
async function loadPanels() {
const urls = ['/api/users', '/api/orders', '/api/stats'];
const results = await Promise.allSettled(urls.map(u => fetch(u).then(r => { if (!r.ok) throw new Error(u); return r.json(); })));
results.forEach(function (r, i) {
const el = document.getElementById('panel' + i);
el.textContent = r.status === 'fulfilled' ? 'OK' : 'Failed to load';
});
}Promise.allSettlederrorsparallel