The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
Handle Fetch errors at four separate stages: the request, the HTTP status, reading or parsing the response body, and cancellation. A 404 or 500 normally does not reject fetch(); it fulfills with a Response, so check response.ok or response.status yourself. Then keep body parsing inside the same error-handling flow and account for aborts.
Why doesn’t fetch throw on a 404?
fetch() rejects for some request-level failures, such as network errors or a malformed URL. An HTTP error status is different: once response headers arrive, the promise normally fulfills with a Response, even when the status is 404 or 500. MDN explains that Fetch rejects on some errors, “but not if the server responds with an error status like 404,” and recommends checking the response status (MDN: Using the Fetch API).
That separation lets your code decide which HTTP statuses count as failures for the application. Check response.ok, which is true for status codes in the 200 range, or inspect response.status when you need status-specific behavior. A fulfilled promise only means Fetch received a response; it does not mean the operation succeeded for your application.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsHow do I handle errors with the JavaScript Fetch API?
Separate the request from status validation and body parsing. This example lets request-level rejections propagate, converts non-OK HTTP responses into application errors, and returns the parsed JSON:
#1 Best Overall
- The Anker Advantage: Join the 65 million+ powered by our leading technology.
- Instant Internet: Connect to the internet instantly from virtually any USB-C 3.0 device, and enjoy stable connection speeds of up to 1 Gbps.
- Lightweight and Compact: The space-saving and portable design measures just over half an inch thick and weighs about the same as a AA battery.
- Premium Build: Features a sleek aluminum exterior and braided-nylon cable to complement the design of high-end devices.
- What You Get: PowerExpand USB-C to Gigabit Ethernet Adapter, welcome guide, 18-month worry-free warranty, and friendly customer service.
async function getJson(url, { signal } = {}) {
const response = await fetch(url, { signal });
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
return response.json();
}
The call to response.json() returns a promise too. Because it is returned from the async function, a body-read or JSON-parsing failure rejects getJson() and can be caught by its caller along with request and status errors:
try {
const data = await getJson("/api/items");
renderItems(data);
} catch (error) {
showError(error);
}
For application-specific reporting, preserve useful details such as the HTTP status rather than reducing every failure to a generic message. Choose whether to retry or surface an error based on the request and application; Fetch error handling alone does not establish a universal retry rule.
Rank #2
- USB-C Meets 1000Mbps Ethernet in Seconds:UGREEN usb c to ethernet adapter supports fast speeds up to 1000Mbps and is backward compatible with 100/10Mbps network. Perfect for work, gaming, streaming, or downloading with a stable, reliable wired connection
- Extend a Ethernet Port for Your Device:This ethernet to usb c adds a Gigabit RJ45 port to your device. It’s the perfect solution for new laptops without built-in Ethernet, devices with damaged LAN ports, or when WiFi is unavailable or unstable
- Plug and Play: This Ethernet adapter is driver-free for Windows 11/10/8.1/8, macOS, Chrome OS, and Android. Drivers are required for Windows XP/7/Vista and Linux, and can be easily installed using our instructions. LED indicator shows status at a glance
- Small Adapter, Big Attention to Detail: The usb c to ethernet features a durable aluminum alloy case for faster heat dissipation than plastic. Its reinforced cable tail and wear-resistant port ensure long-lasting durability. Compact size and easy to carry
- Widely Compatible: The usbc to ethernet adapter is compatible with most laptops, tablets, smartphones, Nintendo Switch, and Steam Deck with USB-C or Thunderbolt 4/3 port, like MacBook Pro/Air, XPS, iPhone 17/16/15 Pro/Pro Max, Mac Mini, Chromebook, iPad
What can fail after the response arrives?
Body reading and JSON parsing
Body methods such as response.json() and response.text() are asynchronous. The read may fail, and JSON parsing can reject if the body is not valid JSON. Keep the body method within the promise flow you handle; checking response.ok does not validate the body.
If you need to inspect a response body as text and also parse it separately, remember that a response body is a stream and ordinarily can be consumed only once. Clone the response before reading when two consumers need the body, as described in MDN’s Fetch API guide.
Rank #3
- Adapter for converting a USB 3.1 Type-C port to a RJ45 Gigabit Ethernet port
- Integrated Ethernet port supports 10M/100M/1000M bandwidth; offers instant Internet connection to the host
- USB-C input allows for reversible plugging; offers complete compatibility with current computers and devices; compatible with Nintendo Switch
- Ready to use, right out of the box; no external power adapter needed
- Slim, compact size and lightweight aluminum housing for easy portability
Unexpected content types
A successful status does not guarantee that the body is JSON. If the endpoint may return other content, inspect the response’s content type before choosing a parser. Use response.text() for text rather than assuming every successful response can be read as JSON.
How should I handle cancellation?
Pass an AbortSignal to fetch() and call abort() on its controller when the request should stop. Cancellation rejects with an AbortError. It can also affect body consumption after headers have arrived: if the request is aborted before the body is read, that read can reject with AbortError (MDN: Using the Fetch API).
Rank #4
- 𝐇𝐢𝐠𝐡-𝐒𝐩𝐞𝐞𝐝 𝐔𝐒𝐁-𝐂 𝐄𝐭𝐡𝐞𝐫𝐧𝐞𝐭 𝐀𝐝𝐚𝐩𝐭𝐞𝐫 - Instantly transform your laptop or tablet’s USB-C port into a reliable wired connection with a 10/100/1000 Mbps RJ45 Ethernet port. Perfect for replacing unstable Wi-Fi in situations that require uninterrupted connectivity, such as online meetings, gaming, and media streaming.
- 𝐔𝐒𝐁-𝐂 𝟑.𝟎 𝐟𝐨𝐫 𝐅𝐚𝐬𝐭𝐞𝐫, 𝐌𝐨𝐫𝐞 𝐒𝐭𝐚𝐛𝐥𝐞 𝐂𝐨𝐧𝐧𝐞𝐜𝐭𝐢𝐨𝐧𝐬 - Experience full Gigabit Ethernet performance over your laptop’s USB-C 3.0 port and elevate your browsing experience to transfer files, play games, video chat, and stream HD videos seamlessly. (To reach 1Gbps, please use CAT6 or up Ethernet cables.)
- 𝐔𝐥𝐭𝐫𝐚-𝐂𝐨𝐦𝐩𝐚𝐜𝐭 𝐚𝐧𝐝 𝐅𝐨𝐥𝐝𝐚𝐛𝐥𝐞 𝐃𝐞𝐬𝐢𝐠𝐧 - At just 2.8 x 1.0 x 0.6 inches, the UE300C slips easily into your laptop bag or pocket. The lightweight yet durable build makes it perfect for travel, remote work, or quick setup in conference rooms.
- 𝐏𝐥𝐮𝐠 𝐚𝐧𝐝 𝐏𝐥𝐚𝐲- No driver required for Windows 11/10/8.1/8/7, macOS, Chrome OS, and Linux (Ubuntu). Simply connect and enjoy instant wired internet access without complicated setup.
- 𝐁𝐫𝐨𝐚𝐝 𝐃𝐞𝐯𝐢𝐜𝐞 𝐂𝐨𝐦𝐩𝐚𝐭𝐢𝐛𝐢𝐥𝐢𝐭𝐲- Works seamlessly with most USB-C devices, including MacBook Pro/Air, iPad Pro, Dell XPS, Surface Laptop, Chromebook, and more—making it a versatile network upgrade for home, office, or on-the-go use.
const controller = new AbortController();
try {
const response = await fetch("/api/items", { signal: controller.signal });
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const items = await response.json();
renderItems(items);
} catch (error) {
if (error.name === "AbortError") {
// Handle expected cancellation, such as a replaced search request.
} else {
showError(error);
}
}
// Call when this operation should be cancelled:
controller.abort();
Whether an abort should be shown as an error depends on the workflow. In a user interface, cancellation may be expected—for example, when a newer search replaces an older one—while other failures may need to be reported.
What can you diagnose from an opaque response?
A response with type opaque, commonly associated with a no-cors request, exposes limited information: its status is 0, its body is null, and its headers are not readable. That means ordinary status and body checks cannot provide useful details about the underlying response. MDN documents these constraints on Response.type.
Quick Recap
Best Value
- 【1Gbps LAN to USB-C Adapter】Obtain stable connection speeds up to 1Gbps; downward compatible with 100Mbps/10Mbps networks. Our Type-C to LAN Gigabit Ethernet (RJ45) Network Adapter supports large downloads at maximum speeds without interruption. (To reach 1Gbps, make sure to use CAT6 & up Ethernet cables.)
- 【Reliable & Endurance Connectivity】Designed specifically for plug-and-play connection between USB-C devices and wired network, provides gigabit ethernet connectivity even when wireless connectivity is Inconsistent or over extended.
- 【Thoughtful Design】Compact and lightweight, with a user-friendly non-slip design for easier plugging and unplugging. Braided nylon cable for extra durability. Premium aluminum casing for better heat dissipation. High-quality USB-C connector provides snug connection with your devices for stable signal transfer. Design to make it easy to connect USB peripherals without blocking adjacent USB-C ports
- 【Wide Compatibility】Compatible with iPhone 15/16 Pro/Max, MacBook Pro 16''/15” (2023/2022/2021/2020/2019/2018/2017), MacBook (2019/2018/2017), MacBook Air 13” (2022/2018), iPad Pro (2022/2020/2018); XPS 13/15/17; Surface Book 2; Google Pixelbook, Chromebook, Pixel, Pixel 2; Asus ZenBook. Compatible with Samsung S20/S10/S9/S8/S8+, Note 8/9, Galaxy Tablet Tab A 10.5, and many other USB-C laptops, tablets, and smartphones. (NOT compatible with Nintendo Switch.)
- 【What You Get】 USB C to Ethernet Adapter 1 pack, An effortless 18-month 𝗐𝖺𝗋𝗋𝖺𝗇𝗍𝗒 and 24/7 professional customer service. If you have any questions, don't hesitate to get in touch with us, we solve most issues within 12 hours. Please rest assured we stand behind our products and customers.
Which failure stage should you handle?
| Failure stage | What Fetch exposes | Application response |
|---|---|---|
| Request-level failure | The fetch() promise rejects, for example on a network error or malformed URL. |
Catch or propagate the rejection; decide whether the operation should be reported or retried. |
| Unsuccessful HTTP status | The promise normally fulfills with a Response; inspect ok or status. |
Branch on the status or throw an application-level error. |
| Body read or parse failure | json() and text() are asynchronous and can reject. |
Keep the body read in the handled promise flow and report parsing or read failures appropriately. |
| Cancellation | Aborting rejects with AbortError; a later body read can also reject after headers arrive. |
Distinguish expected cancellation from failures that should be shown to the user. |
| Opaque response | Status 0, null body, and unreadable headers. |
Recognize that the response provides little diagnostic information. |
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

