Skip to content

Commit

Permalink
Improving an exception message about dependency matching. Closes GH-379
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremydmiller committed Sep 7, 2023
1 parent d7ea093 commit 6619883
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Lamar/IoC/Instances/CtorArg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Reflection;
using JasperFx.CodeGeneration.Model;
using JasperFx.Core;
using JasperFx.Core.Reflection;
using Lamar.IoC.Frames;

namespace Lamar.IoC.Instances;
Expand All @@ -23,7 +24,7 @@ public CtorArg(ParameterInfo parameter, Instance instance)
catch (Exception e)
{
throw new InvalidOperationException(
$"Cannot create a Constructor Argument for {parameter.Name} of {instance}", e);
$"Cannot create a Constructor Argument for {parameter?.Name ?? "anonymous"} of type {parameter.ParameterType.FullNameInCode()} of {instance}. If this is a primitive type like strings or numbers, Lamar will not do any automatic resolution by type", e);
}
}

Expand Down

0 comments on commit 6619883

Please sign in to comment.