Skip to content

refactor: improve error handling by logging errors in catch blocks#329

Closed
ronak-ravtode wants to merge 2 commits into
Sachinchaurasiya360:mainfrom
ronak-ravtode:refactor/empty-catch-block-improvement
Closed

refactor: improve error handling by logging errors in catch blocks#329
ronak-ravtode wants to merge 2 commits into
Sachinchaurasiya360:mainfrom
ronak-ravtode:refactor/empty-catch-block-improvement

Conversation

@ronak-ravtode
Copy link
Copy Markdown

@ronak-ravtode ronak-ravtode commented May 19, 2026

Issue #320

Summary

Fixed 16+ empty .catch() blocks across the codebase that were silently swallowing errors without logging or user feedback. This was causing poor UX (users seeing broken/frozen UI with no explanation) and making debugging nearly impossible since errors vanished with no trace.

Changes

File Line Change
client/src/module/student/profile/StudentProfilePage.tsx 239 Added console.error("Failed to load job preferences:", err)
client/src/module/student/profile/StudentProfilePage.tsx 224 Improved error logging with console.error
client/src/module/student/python/lib/python-engine.ts 52 Added console.error("Failed to preload Pyodide:", err)
client/src/module/student/python/lib/python-engine.ts 125 Added console.error("Failed to reset Python stdout/stderr:", err)
client/src/module/student/skill-verification/SkillTestPage.tsx 198 Added console.error("Failed to exit fullscreen:", err)
client/src/module/student/interview-prep/interviewProgress.ts 269 Added console.error("Failed to update visit progress:", err)
client/src/module/student/interview-prep/interviewProgress.ts 292 Added console.error("Failed to sync visit progress:", err)
client/src/module/student/interview-prep/InterviewQuestionPage.tsx 142 Added console.error("Failed to toggle question completion:", err)
client/src/module/student/companies/CompanyListPage.tsx 629 Added console.error("Failed to load cities:", err)
client/src/module/student/companies/CompanyDetailPage.tsx 113 Added console.error("Failed to load reviews:", err)
client/src/module/scraped-jobs/ScrapedJobsPage.tsx 40 Added console.error("Failed to load job sources:", err)
client/src/module/recruiter/applications/ApplicationDetail.tsx 31 Added console.error("Failed to load verified skills:", err)
client/src/module/admin/AdminSubscribersPage.tsx 30 Added console.error("Failed to load subscribers:", err)
client/src/lib/milestone.utils.ts 4 Added console.error("Failed to report milestone:", err)
client/src/hooks/useFaceDetection.ts 79 Added console.error("Failed to start video playback:", err)
client/src/lib/auth.store.ts 40 Added console.error("Failed to clear session on logout:", err)

How to test

  1. Verify no empty catch blocks remain:
    grep -r "\.catch(() => {})" client/src/
    grep -r "catch({})" client/src/
  2. Test error logging works:
  • Trigger errors in affected areas (e.g., network failures, API errors)
  • Check browser console for proper error messages with context
  • Verify no silent failures occur in critical paths (auth, profile, job preferences, Python engine)
  1. Test affected pages load correctly:
  • Student profile page loads with job preferences
  • Python code execution works
  • Interview progress tracking syncs
  • Company lists and details load properly

Screenshots

No UI changes - this is a backend/logging fix. Error messages now appear in the browser console for debugging, but no user-facing UI was modified.

Summary by CodeRabbit

  • Bug Fixes
    • Improved error handling throughout the application. Error conditions in features like face detection, authentication, job sourcing, skill verification, and profile management are now properly reported, making it easier to identify and troubleshoot issues.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2dedddfc-e4ed-44ba-a9cd-8a82aa0e118d

📥 Commits

Reviewing files that changed from the base of the PR and between 2adfe08 and 719eea4.

📒 Files selected for processing (1)
  • client/src/lib/auth.store.ts

📝 Walkthrough

Walkthrough

Replaces 15 silent .catch() handlers with console.error() logging across authentication, data-fetching, server-reporting, media playback, and specialized modules to improve error visibility during development and debugging.

Changes

Error Handling Improvements

Layer / File(s) Summary
Add console.error logging to async operation failure handlers
client/src/lib/auth.store.ts, client/src/lib/milestone.utils.ts, client/src/hooks/useFaceDetection.ts, client/src/module/admin/AdminSubscribersPage.tsx, client/src/module/recruiter/applications/ApplicationDetail.tsx, client/src/module/scraped-jobs/ScrapedJobsPage.tsx, client/src/module/student/companies/CompanyDetailPage.tsx, client/src/module/student/companies/CompanyListPage.tsx, client/src/module/student/interview-prep/interviewProgress.ts, client/src/module/student/profile/StudentProfilePage.tsx, client/src/module/student/python/lib/python-engine.ts, client/src/module/student/skill-verification/SkillTestPage.tsx
Replace 15 empty catch handlers with console.error() calls that log descriptive messages and error objects. Changes span logout session handling, milestone reporting, face-detection video playback, subscriber/skill/city/review/source/preference fetches, interview progress synchronization, Python engine preload and stream reset, and fullscreen exit operations.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

  • Sachinchaurasiya360/InternHack#320: These changes directly address the reported issue by adding console.error logging to silent catch handlers across the same files and functions, improving error visibility during development and debugging.

Possibly related PRs

  • Sachinchaurasiya360/InternHack#273: Both PRs modify client/src/lib/auth.store.ts's logout logic—this PR adds console.error logging to the logout fetch error handler, while the retrieved PR extends logout to clear interview-progress localStorage keys.

Suggested labels

gssoc:approved

Poem

🐰 When promises break and errors hide,
Log them loud, the debugger's guide!
Console whispers secrets, no more silent screams,
Catch them all, fulfill the developer's dreams.
Thump thump!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: replacing empty catch blocks with console.error logging across the codebase.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ronak-ravtode
Copy link
Copy Markdown
Author

i am GSSOC'26 contrituber so kindly add tags according to you before merge.

@Sachinchaurasiya360 Sachinchaurasiya360 added bug Something isn't working good first issue Good for newcomers level:intermediate Requires moderate project understanding gssoc:approved Approved for GSSoC scoring labels May 21, 2026
@Sachinchaurasiya360
Copy link
Copy Markdown
Owner

There is some conflict it can you look it into it

@Sachinchaurasiya360
Copy link
Copy Markdown
Owner

Duplicate PR

@ronak-ravtode
Copy link
Copy Markdown
Author

give me pr number of my duplicate pr, i didn't find it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working good first issue Good for newcomers gssoc:approved Approved for GSSoC scoring level:intermediate Requires moderate project understanding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants