LakshayGMZ / ipuSenpai

A modern, open-source, beautifully designed, ready-to-use academic leaderboard for IPU students.
https://ipusenpai.in
GNU General Public License v3.0
20 stars 5 forks source link

Handle cases when enrollment number is invalid or doesn't exists #35

Closed martian0x80 closed 4 months ago

martian0x80 commented 5 months ago

Description:

Currently, this is the most common issue according to Sentry, writing an invalid enrollment number in /student results in a client side exception.

Failed to fetch data. URL: https://api.ipusenpai.in/student/03816491522

To reproduce:

Go to https://ipusenpai.in/student/03816491522

Expected behaviour:

Should not raise a client side exception, and pop a new dialog or a toast (https://ui.shadcn.com/docs/components/sonner) with a message about the invalid/non-existing enrollment no.

martian0x80 commented 5 months ago

The exception can be narrowed down to this:

https://github.com/LakshayGMZ/ipuSenpai/blob/191389d0c4ab6190ecb1f26a9301b1fc0200963c/app/lib/dataFetchServer.tsx#L21-L26

We need to discuss a common solution to this, that is if the API response needs to follow a specific pattern. Currently the response by the API is just a single message that says:

{
  "message": "Student ki jankaari nahi mili, bhai"
}

lol

LakshayGMZ commented 5 months ago

🔫 @martian0x80 shuuu

sentry-io[bot] commented 5 months ago

Sentry Issue: IPUSENPAI-T

LakshayGMZ commented 4 months ago

fixed