### Fetch Data with Error Handling Source: https://github.com/aaronpowell/httpstatus/blob/main/README.md This JavaScript snippet demonstrates how to fetch data from httpstat.us and handle potential errors, specifically for a 500 Internal Server Error. ```javascript async function getData(url) { const res = await fetch(url); if (!res.ok) { throw new Error("Failed to get data"); } return await res.json(); } getData("https://httpstat.us/500").then(console.log).catch(console.error); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.