From d12a7da646ba37b2fb85618d29fb5e5255130017 Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Tue, 18 Aug 2026 15:50:19 +0800 Subject: [PATCH] fix: check response status in content script fetches --- content.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/content.js b/content.js index 446a951..eb10d49 100644 --- a/content.js +++ b/content.js @@ -77,6 +77,7 @@ body: body.toString(), credentials: 'same-origin' }); + if (!resp.ok) throw new Error('Offered courses request failed: ' + resp.status); const html = await resp.text(); const courses = ISMIStools.parseOfferedCourses(html); const match = courses.find((c) => c.courseCode === courseCode); @@ -115,6 +116,7 @@ let header = {}; try { const resp = await fetch('/Manage/Student', { credentials: 'same-origin' }); + if (!resp.ok) throw new Error('Profile request failed: ' + resp.status); const html = await resp.text(); header = ISMIStools.parseProfilePage(html); } catch (e) {