feat: enhance error handling in git-push and repo services#1406
Open
dcoric wants to merge 3 commits intofinos:mainfrom
Open
feat: enhance error handling in git-push and repo services#1406dcoric wants to merge 3 commits intofinos:mainfrom
dcoric wants to merge 3 commits intofinos:mainfrom
Conversation
… for error scenarios
- 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
✅ Deploy Preview for endearing-brigadeiros-63f9d0 canceled.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
src/ui/services/errors.tswith reusable error utilities (getServiceError,errorResult,successResult)git-push.tsandrepo.tsservices to use the new error handling utilitiesPushDetails.tsx,RepoDetails.tsx, etc.) to properly handle and display error statesServiceResult<T>objects with success/failure statesTest 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