saritasa-nest / saritasa-dotnet-tools

Development Tools For Company'S .NET Projects.
BSD 2-Clause "Simplified" License
27 stars 13 forks source link

Change exception type when command is null #47

Closed dermeister0 closed 6 years ago

dermeister0 commented 6 years ago

Message pipeline throws ArgumentNullException when command is null.

System.ArgumentNullException: Value cannot be null. Parameter name: command at Saritasa.Tools.Messages.Commands.CommandPipeline.CreateMessageContext(IMessagePipelineService pipelineService, Object command) at Saritasa.Tools.Messages.Abstractions.MessagePipelineServiceExtensions.d__3.MoveNext()

Is it possible to throw MessageProcessingException instead? I need something like CommandValidationMiddleware to validate null commands.

krasninja commented 6 years ago

I'm thinking to move message context formatting into separate middleware. This would make pipeline move flexible and you can override this behavior.