What happened

response.json() threw before the error check.

Parse defensively.

Build the lesson into your workflow.