function getProfile(userId) { if (userId === 0) { return Promise.reject(new Error("profile API unavailable")); } return Promise.resolve({ id: userId, name: "Aisha" }); } async function loadProfile(userId) { try { const profile = await getProfile(userId); return `Loaded ${profile.name}`; } catch (error) { return `Request failed: ${error.message}`; } } console.log(await loadProfile(42)); console.log(await loadProfile(0));