Merged
Conversation
- 修复 fetch 失败时引用未定义变量 json 导致的 ReferenceError - 修正提示文案 "Your browser outdated" 为 "Your browser is outdated"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
md标签在 fetch 请求失败时引用未定义变量json导致的ReferenceError,改为使用当前作用域内的status和data输出有意义的错误信息"Your browser outdated"→"Your browser is outdated"Details
当使用
{% md URL %}标签加载远程 Markdown 文件时,如果 HTTP 请求返回非 200 状态码,原代码执行throw new Error(JSON.stringify(json.error)),但当前作用域中并不存在json变量(只有ok、status、data、headers),导致抛出ReferenceError: json is not defined,掩盖了真实的请求失败原因。修复后会输出
Request failed with status {status}: {data},便于定位问题。Made with Cursor