Add exception and model validation filters for improved error handling#15
Merged
VladKovtun99 merged 6 commits intomainfrom Aug 4, 2025
Merged
Add exception and model validation filters for improved error handling#15VladKovtun99 merged 6 commits intomainfrom
VladKovtun99 merged 6 commits intomainfrom
Conversation
KSemenenko
reviewed
Aug 4, 2025
ManagedCode.Communication.Extensions/Extensions/CommunicationAppBuilderExtensions.cs
Outdated
Show resolved
Hide resolved
ManagedCode.Communication.Extensions/ModelValidationFilterBase.cs
Outdated
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the exception and error handling system to improve API consistency and error reporting. The changes introduce a new Problem model following RFC 7807 standards, refactor exception handling methods to return boolean values instead of void, and implement dedicated filter base classes for better error handling across controllers and SignalR hubs.
Key changes:
- Refactored
ThrowIfFailmethods to return boolean values with proper null-safety annotations - Added new Problem class implementing RFC 7807 problem details specification
- Replaced middleware-based error handling with dedicated filter base classes for controllers and SignalR hubs
Reviewed Changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| ManagedCode.Communication/ResultT/Result.cs | Modified ThrowIfFail methods to return bool and added MemberNotNullWhen attributes |
| ManagedCode.Communication/Result/Result.cs | Similar ThrowIfFail method changes and added using statement for CodeAnalysis |
| ManagedCode.Communication/Problem.cs | New RFC 7807 compliant Problem class for structured error reporting |
| ManagedCode.Communication/IResultError.cs | Updated interface signatures for ThrowIfFail methods |
| ManagedCode.Communication/Error.cs | Removed unused using statements |
| ManagedCode.Communication/CollectionResultT/CollectionResult.cs | Applied ThrowIfFail method changes with MemberNotNullWhen attributes |
| ManagedCode.Communication.Extensions/sdf.cs | New exception handler implementation |
| ManagedCode.Communication.Extensions/ModelValidationFilterBase.cs | New base class for model validation filtering |
| ManagedCode.Communication.Extensions/HubExceptionFilterBase.cs | New base class for SignalR hub exception filtering |
| ManagedCode.Communication.Extensions/ExceptionFilterBase.cs | New base class for general exception filtering |
| Multiple test and extension files | Updated to use new filter system and Problem model |
Comments suppressed due to low confidence (1)
ManagedCode.Communication.Extensions/sdf.cs:1
- The filename 'sdf.cs' is not descriptive and appears to be a placeholder or temporary name. It should be renamed to reflect its actual purpose, such as 'CommunicationExceptionHandler.cs'.
using System;
ManagedCode.Communication/CollectionResultT/CollectionResult.cs
Outdated
Show resolved
Hide resolved
ManagedCode.Communication.Extensions/Extensions/ServiceCollectionExtensions.cs
Show resolved
Hide resolved
…Constants for better maintainability
…mline extension key references
KSemenenko
approved these changes
Aug 4, 2025
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.
No description provided.