Skip to content

Refactor portal error handling, add integration tests#4825

Merged
rockfordlhotka merged 7 commits into
MarimerLLC:mainfrom
luizfbicalho:feature/remove-catch-dataportal
Feb 16, 2026
Merged

Refactor portal error handling, add integration tests#4825
rockfordlhotka merged 7 commits into
MarimerLLC:mainfrom
luizfbicalho:feature/remove-catch-dataportal

Conversation

@luizfbicalho
Copy link
Copy Markdown
Contributor

Removed redundant catch/rethrow blocks from GrpcPortal, RabbitMqPortal, and HttpPortal methods to simplify error handling. Cleaned up using directives and parameter formatting. Added comprehensive integration and unit tests for all three portal hosts, improving coverage of core operations, error scenarios, and context handling. Tests use MSTest and FluentAssertions with fake IDataPortalServer implementations.

#4465

Removed redundant catch/rethrow blocks from GrpcPortal, RabbitMqPortal, and HttpPortal methods to simplify error handling. Cleaned up using directives and parameter formatting. Added comprehensive integration and unit tests for all three portal hosts, improving coverage of core operations, error scenarios, and context handling. Tests use MSTest and FluentAssertions with fake IDataPortalServer implementations.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request addresses issue #4465 by removing redundant catch/rethrow blocks from three portal implementations (HttpPortal, GrpcPortal, and RabbitMqPortal). These catch blocks were creating DataPortalErrorInfo objects that were never used because the exception would be re-thrown and caught at a higher level (in HttpPortalController, GrpcPortal.InvokePortal, and RabbitMqPortal.InvokePortal respectively), where the error is properly converted to a DataPortalResponse with error data. The PR also includes minor code cleanup (using directive organization, whitespace normalization) and adds comprehensive test coverage for HttpPortal. Additionally, it adds integration test files for RabbitMq and Grpc portals, though these tests don't actually test the portal implementations themselves.

Changes:

  • Removed redundant catch/rethrow blocks from Create, Fetch, Update, and Delete methods in HttpPortal, GrpcPortal, and RabbitMqPortal
  • Added comprehensive unit tests for HttpPortal covering success and error scenarios for all operations
  • Added integration test files for RabbitMq and Grpc portals (though these test FakeDataPortalServer directly rather than the actual portal classes)

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
Source/Csla.Web.Mvc.Shared/Server/Hosts/HttpPortal.cs Removed redundant catch/rethrow blocks from all CRUD methods; reorganized using directives alphabetically; normalized whitespace
Source/Csla.Channels.RabbitMq/RabbitMqPortal.cs Removed redundant catch/rethrow blocks from all CRUD methods; removed unused System.Diagnostics using; normalized whitespace
Source/Csla.Channels.Grpc/GrpcPortal.cs Removed redundant catch/rethrow blocks from all CRUD methods; normalized whitespace in cast expressions
Source/tests/Csla.test/Server/Hosts/HttpPortalTests.cs Added comprehensive unit tests for HttpPortal including constructor validation, CRUD operations, error handling, and primitive criteria handling
Source/tests/Csla.test/Channels/RabbitMq/RabbitMqPortalIntegrationTests.cs Added tests that validate IDataPortalServer behavior but don't actually test RabbitMqPortal class
Source/tests/Csla.test/Channels/Grpc/GrpcPortalIntegrationTests.cs Added tests that validate IDataPortalServer behavior but don't actually test GrpcPortal class

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Source/tests/Csla.test/Channels/RabbitMq/RabbitMqPortalIntegrationTests.cs Outdated
Comment thread Source/tests/Csla.test/Channels/Grpc/GrpcPortalIntegrationTests.cs Outdated
Comment thread Source/tests/Csla.test/Channels/RabbitMq/RabbitMqPortalIntegrationTests.cs Outdated
Comment thread Source/tests/Csla.test/Channels/Grpc/GrpcPortalIntegrationTests.cs
Refactored GrpcPortal, RabbitMqPortal, and HttpPortal tests to use a standardized TestCslaObject for criteria and return values. Updated test assertions to check ErrorData instead of Error. Simplified context and principal preservation tests. Added project references for Grpc and RabbitMq channels. Removed obsolete FakeMobileObject class.
RabbitMqPortalIntegrationTests.cs and all related tests were deleted. The Csla.Channels.RabbitMq project reference was also removed from Csla.Tests.csproj, eliminating RabbitMQ dependencies from the test project.
@rockfordlhotka rockfordlhotka linked an issue Feb 16, 2026 that may be closed by this pull request
@rockfordlhotka rockfordlhotka merged commit 29d50e9 into MarimerLLC:main Feb 16, 2026
2 checks passed
@luizfbicalho luizfbicalho deleted the feature/remove-catch-dataportal branch February 16, 2026 22:46
@luizfbicalho luizfbicalho restored the feature/remove-catch-dataportal branch March 15, 2026 23:39
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.

Unnecessary creation of an error object which is never used?

3 participants