Skip to content

Standardize Error Messages and Response Formats #75

Merged
LaGodxy merged 4 commits intoMettaChain:mainfrom
Adedayo-Data:main
Feb 26, 2026
Merged

Standardize Error Messages and Response Formats #75
LaGodxy merged 4 commits intoMettaChain:mainfrom
Adedayo-Data:main

Conversation

@Adedayo-Data
Copy link
Contributor

Overview

This PR implements a centralized and standardized error-handling architecture across the PropChain-BackEnd. Previously, error responses were inconsistent in structure and message format. This refactor ensures that every endpoint returns a predictable, REST-compliant error object, improving the developer experience for frontend integration and debugging.

Changes Made Includes:

1. Centralized Error Module: Implemented a core error-handling layer in src/common/errors with custom exception classes (e.g., InvalidCredentialsException, UserNotFoundException, BusinessRuleViolationException).

2. Response Standardization: All error responses now follow a consistent template including status, message, timestamp, and category.

3. Service Integration:

    - Updated AuthService to use standardized credential validation errors.

    - Refactored PropertiesService (findOne, update, create, remove) to utilize custom exceptions and proper HTTP status codes.

4. Test Suite Alignment:

    - Updated test/auth/auth.service.spec.ts to match standardized error strings.

    - Resolved constructor mismatches and import conflicts in test/properties/properties.service.spec.ts.

    - Verified that all 266 tests (including unit, performance, and validation) are passing.

closes #49
Screenshot From 2026-02-24 17-55-03

…r better error handling

refactor(errors): integrate I18nService for localized error messages in exception filter

refactor(properties): streamline property service methods and enhance error handling with custom exceptions

fix(main): include ErrorResponseDto in Swagger documentation for improved API response clarity

feat(properties): implement ApiStandardErrorResponse decorator for consistent error responses across property endpoints
@LaGodxy
Copy link
Contributor

LaGodxy commented Feb 25, 2026

@Adedayo-Data resolve conflicts.

@Adedayo-Data
Copy link
Contributor Author

Merge conflict resolved. Please resolve

@LaGodxy LaGodxy merged commit 74234c2 into MettaChain:main Feb 26, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standardize Error Messages and Response Formats

2 participants