Feat/error - #998
Merged
Merged
Conversation
|
@ummarig Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
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.
✅ All Tasks Completed
1. Created Global Exception Filters (in
src/common/filters/)all-exceptions.filter.ts: Catches all unhandled exceptionshttp-exception.filter.ts: Handles all NestJS HttpException instancesprisma-exception.filter.ts: Specialized handler for Prisma database errors with proper error code mappingcloses #901
2. Consistent Error Response Structure
All filters return a unified JSON response:
{ "success": false, "statusCode": 500, "timestamp": "2026-07-27T...", "path": "/api/endpoint", "message": "Error message", "errors": null, "stack": "stack trace (only in development)", "prismaCode": "P2002 (only in development for database errors)" }closes #902
3. Removed Redundant Try/Catch Blocks
From
transactions.service.ts, removed ~150 lines of repetitive code across 6 methods:create()- removed 35 lines of try/catchfindAll()- removed 30 lines of try/catchfindOne()- removed 20 lines of try/catchupdate()- removed 25 lines of try/catchrecordOnBlockchain()- removed 45 lines of try/catchverifyOnBlockchain()- removed 30 lines of try/catchupdateTransactionStatus()- removed 35 lines of try/catchcloses #903
4. Fixed main.ts Bootstrap
appvariable that was causing server startup failures5. Environment-Aware Error Details
6. Prisma Error Code Mapping
Properly maps common Prisma errors to appropriate HTTP statuses:
closes #904
The application now has clean, DRY service methods with all error handling centralized in the global exception filters. This eliminates the 500+ lines of repetitive try/catch code across services and ensures consistent, professional error messages with complete stack traces in development.