1
0
mirror of synced 2024-11-24 09:50:11 +00:00

Controller and method name in TopologyConfigurationException

This commit is contained in:
Mark van Renswoude 2019-01-07 16:53:30 +01:00
parent 4ab6f67ea6
commit 182459edbc

View File

@ -8,11 +8,11 @@ namespace Tapeti.Default
public void Handle(IBindingContext context, Action next)
{
if (context.Parameters.Count == 0)
throw new TopologyConfigurationException("First parameter must be a message class");
throw new TopologyConfigurationException($"First parameter of method {context.Method.Name} in controller {context.Method.DeclaringType?.Name} must be a message class");
var parameter = context.Parameters[0];
if (!parameter.Info.ParameterType.IsClass)
throw new TopologyConfigurationException($"First parameter {parameter.Info.Name} must be a message class");
throw new TopologyConfigurationException($"First parameter {parameter.Info.Name} of method {context.Method.Name} in controller {context.Method.DeclaringType?.Name} must be a message class");
parameter.SetBinding(messageContext => messageContext.Message);
context.MessageClass = parameter.Info.ParameterType;