Skip to content

🐛 [Bug report]: Missing Response Status Check Before JSON Parsing(hard) #166

@Abhrxdip

Description

@Abhrxdip

Contributor Guidelines

  • I have read the guidelines and discussion

Describe the bug?

Both fetch implementations don't check res.ok before calling .json(), which will throw unhandled errors for 4xx/5xx responses.

const res = await fetch(HASHNODE_API_URL, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({...}),
});
const { data }: { data: { publication: HashnodePublication } } = await res.json(); // No res.ok check!
Impact: Network errors or API failures will cause cryptic JSON parsing errors instead of meaningful error messages.

Desktop or Mobile (Please provide your system information)

os

Screenshot / ScreenShare

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions