Skip to content

Refactor: Implement type-safe error handling in challenge room#219

Merged
MohitBareja16 merged 1 commit into
ThePlator:mainfrom
MohitBareja16:fix/challenge-room-types
Jun 1, 2026
Merged

Refactor: Implement type-safe error handling in challenge room#219
MohitBareja16 merged 1 commit into
ThePlator:mainfrom
MohitBareja16:fix/challenge-room-types

Conversation

@MohitBareja16

@MohitBareja16 MohitBareja16 commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Description

Closes #218

This PR eliminates the any type from the core code submission error handler in the challenge room (frontend/src/app/challenges/[id]/page.tsx).

Changes Made

  • Type-Safe Catch Block: Replaced catch (error: any) with catch (error: unknown) during the handleSubmit API call.
  • Error Type-Guards: Added an error instanceof Error conditional check when setting the terminal output string. This prevents runtime errors and undefined state issues if a non-standard object or primitive is thrown by the browser's fetch engine.

Verification

  • Simulated a network failure during code submission.
  • Verified that the custom terminal safely catches the error and outputs the fallback text without crashing the page.

@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

@MohitBareja16 is attempting to deploy a commit to the Sameer's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added level:beginner Beginner level difficulty quality:clean Clean code quality type:refactor Refactor gssoc:approved Approved for GirlScript Summer of Code labels Jun 1, 2026
@MohitBareja16 MohitBareja16 added level:intermediate Intermediate level difficulty quality:exceptional Exceptional code quality and removed level:beginner Beginner level difficulty quality:clean Clean code quality labels Jun 1, 2026
@MohitBareja16 MohitBareja16 merged commit 10ed3d1 into ThePlator:main Jun 1, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc:approved Approved for GirlScript Summer of Code level:intermediate Intermediate level difficulty quality:exceptional Exceptional code quality type:refactor Refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor: Implement type-safe error handling in challenge room

1 participant