Files
2026-09-21 12:15:57 +03:00

20 lines
819 B
C#

using System;
using System.Linq;
using Reflex.Caching;
using Reflex.Extensions;
namespace Reflex.Exceptions
{
internal sealed class ConstructorInjectorException : Exception
{
public ConstructorInjectorException(Type type, Exception exception, MemberParamInfo[] constructorParameters) : base(BuildMessage(type, exception, constructorParameters), exception)
{
}
private static string BuildMessage(Type type, Exception exception, MemberParamInfo[] constructorParameters)
{
var constructorSignature = $"{type.Name} ({string.Join(", ", constructorParameters.Select(t => t.ParameterType.Name))})";
return $"{exception.Message} occurred while instantiating object type '{type.GetFullName()}' using constructor {constructorSignature}";
}
}
}