refactor(error): add decentralized error category infrastructure#302
Merged
Merged
Conversation
…se 1) Implement the foundational infrastructure for the decentralized error category system to improve system isolation and reduce coupling. Key additions: - error_category: Abstract base class following std::error_category pattern - common_error_category: Singleton for common/shared error codes - typed_error_code: Type-safe error code with category reference - Helper functions: make_typed_error_code, is_success, is_error - Integration with Result<T> via error_info constructor Design decisions: - Named typed_error_code to avoid conflict with existing error_code alias - error_info now accepts typed_error_code for seamless integration - Preserved backward compatibility with error_code = error_info alias - Categories use singleton pattern with thread-safe initialization This is Phase 1 of the decentralized error system. Future phases will: - Migrate existing errors to common_error_category - Create system-specific categories (network, database, etc.) - Deprecate centralized error_codes.h Closes #300
21 tasks
kcenon
added a commit
that referenced
this pull request
Apr 13, 2026
…se 1) (#302) Implement the foundational infrastructure for the decentralized error category system to improve system isolation and reduce coupling. Key additions: - error_category: Abstract base class following std::error_category pattern - common_error_category: Singleton for common/shared error codes - typed_error_code: Type-safe error code with category reference - Helper functions: make_typed_error_code, is_success, is_error - Integration with Result<T> via error_info constructor Design decisions: - Named typed_error_code to avoid conflict with existing error_code alias - error_info now accepts typed_error_code for seamless integration - Preserved backward compatibility with error_code = error_info alias - Categories use singleton pattern with thread-safe initialization This is Phase 1 of the decentralized error system. Future phases will: - Migrate existing errors to common_error_category - Create system-specific categories (network, database, etc.) - Deprecate centralized error_codes.h Closes #300
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 implements Phase 1 of the decentralized error category system to improve system isolation and reduce coupling between components.
Key Changes
std::error_categorypattern for system-specific error categoriesmake_typed_error_code(),is_success(),is_error()for convenient error code creation and checkingerror_infocan now be constructed fromtyped_error_codefor seamless integrationDesign Decisions
typed_error_codeto avoid conflict with existingusing error_code = error_info;aliaserror_codealias (marked deprecated)Architecture
Future Phases (not in this PR)
common_error_categoryerror_codes.hTest Plan
error_categorybase class functionalitycommon_error_categoryimplementationtyped_error_codeclass with category supportResult<T>Closes #300