Skip to content

feat: enhance error handling in git-push and repo services#1406

Open
dcoric wants to merge 3 commits intofinos:mainfrom
dcoric:denis-coric/fix-1392-linked
Open

feat: enhance error handling in git-push and repo services#1406
dcoric wants to merge 3 commits intofinos:mainfrom
dcoric:denis-coric/fix-1392-linked

Conversation

@dcoric
Copy link
Contributor

@dcoric dcoric commented Feb 13, 2026

Summary

This PR fixes both:

Improve error handling and test coverage for UI services

This PR refactors error handling across the UI service layer and adds comprehensive test coverage. Error handling is now consistent, type-safe, and properly tested.

What's changed

Error handling improvements:

  • Added src/ui/services/errors.ts with reusable error utilities (getServiceError, errorResult, successResult)
  • Refactored git-push.ts and repo.ts services to use the new error handling utilities
  • Updated UI views (PushDetails.tsx, RepoDetails.tsx, etc.) to properly handle and display error states
  • All service functions now return consistent ServiceResult<T> objects with success/failure states

Test coverage (14 → 79 tests):

  • test/ui/errors.test.ts - comprehensive tests for error utility functions (18 tests)
  • test/ui/user.test.ts - tests for user service functions (13 tests)
  • test/ui/git-push.test.ts - expanded coverage for all git-push functions (13 tests)
  • test/ui/repo.test.ts - expanded coverage for all repo functions (21 tests)

Tests cover success paths, HTTP errors (401/403/404/409/500), network failures, and edge cases.

Benefits

  • Consistent error handling - all services use the same pattern
  • Better UX - proper error messages shown to users
  • Type safety - TypeScript ensures correct error handling
  • Test coverage - prevents regressions and documents expected behavior
Screenshot 2026-02-13 at 18 20 59

- Add new test file for errors.ts utility functions (18 tests)
- Expand git-push.test.ts to cover getPush and getPushes functions (13 tests total)
- Expand repo.test.ts to cover getRepos, addRepo, deleteUser, and deleteRepo (21 tests total)
- Add new test file for user.ts service functions (13 tests)
- All tests verify both success and error handling scenarios
- Total test count increased from 14 to 79 tests for UI services
@netlify
Copy link

netlify bot commented Feb 13, 2026

Deploy Preview for endearing-brigadeiros-63f9d0 canceled.

Name Link
🔨 Latest commit 76559e3
🔍 Latest deploy log https://app.netlify.com/projects/endearing-brigadeiros-63f9d0/deploys/698f6209abca990008496cbd

@dcoric dcoric requested a review from fabiovincenzi February 13, 2026 17:40
@dcoric dcoric requested a review from jescalada February 13, 2026 17:40
@dcoric dcoric self-assigned this Feb 13, 2026
@dcoric dcoric requested a review from kriswest February 13, 2026 17:41
@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.25%. Comparing base (2f71c12) to head (76559e3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1406   +/-   ##
=======================================
  Coverage   81.25%   81.25%           
=======================================
  Files          65       65           
  Lines        4657     4657           
  Branches      792      792           
=======================================
  Hits         3784     3784           
  Misses        858      858           
  Partials       15       15           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Poor error messaging in the admin UI when the user is not logged in Improve UI error handling and API error codes

1 participant