IMGIITRoorkee / IMGIITRoorkee/Ticketify
Add Error Handling for Non-Existent Ticket IDs in Ticket Page
- Dominant language
- JavaScript
- Stars
- 0
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
**Description:**
Currently, the `TicketPage` doesn't properly handle the case when the `id` provided does not exist in the system. If the ID doesn't correspond to an existing ticket, the page crashes unexpectedly.
**Expected Behavior:**
- If the `id` does not correspond to any ticket, the user should see a clear error message like "Ticket not found" or be redirected to a custom 404 page.
- The `getTicketById` function should handle invalid cases gracefully by returning a `null` or some indication when the ticket is not found, avoiding any crashes or undefined states.
**Steps to Reproduce:**
1. Attempt to access `TicketPage` with an invalid ticket ID (for eg. try hitting `http://localhost:3000/TicketPage/invalid-ticket-id`).
2. Observe that the app breaks.
---
We need to make sure the `getTicketById` function correctly handles failure scenarios, including cases where the API does not return a valid ticket, and shows appropriate feedback on the page.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by locating the TicketPage entry point and the getTicketById function, then reproduce the failure with an invalid ID such as /TicketPage/invalid-ticket-id. Trace how a missing or invalid API result reaches the page. Done means the page shows a clear not-found message or custom 404 instead of crashing, and valid ticket pages still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nextjs
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100