---
title: "Discussion on \"[JS] fetch 不捕获 4xx\" | Hashnode"
description: "Discussion on \"[JS] fetch 不捕获 4xx\". 参考：\n\nhttps://www.ruanyifeng.com/blog/2020/12/fetch-tutorial.html\n\nhttps://cloud.tencent.com/developer/ask/sof/107056516\n\n\n最近有一个需求需要重写 fetch ，一开始我是这样写的\ntry {\n    const res = await fetch(\"xxx\");\n} catch(err) {\n    console.error(err);\n}\n\n但是后面发现 fetch 在遇..."
url: "https://hashnode.com/posts/js-fetch-4xx/6871dbac303a26d9961dd3a9"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [\[JS\] fetch 不捕获 4xx](https://lordmoon.hashnode.dev/js-fetch-4xx?utm_source=hashnode&utm_medium=feed)

参考： https://www.ruanyifeng.com/blog/2020/12/fetch-tutorial.html https://cloud.tencent.com/developer/ask/sof/107056516 最近有一个需求需要重写 fetch ，一开始我是这样写的 try { const res = await fetch("xxx"); } catch(err) { console.error(err); } 但是后面发现 fetch 在遇...

Jul 12, 2025 · 1 min read · lordmoon.hashnode.dev  
Read the article

## Written by

[lordmoon](https://hashnode.com/@lordmoon3)

@lordmoon3

  
[View profile](https://hashnode.com/@lordmoon3)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
