1
0
mirror of synced 2024-11-05 02:59:16 +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) public void Handle(IBindingContext context, Action next)
{ {
if (context.Parameters.Count == 0) 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]; var parameter = context.Parameters[0];
if (!parameter.Info.ParameterType.IsClass) 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); parameter.SetBinding(messageContext => messageContext.Message);
context.MessageClass = parameter.Info.ParameterType; context.MessageClass = parameter.Info.ParameterType;