Skip to content

Commit e9712e3

Browse files
Fix missing inner exception on Field/Property/Method InjectorException
1 parent ae74404 commit e9712e3

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

Assets/Reflex/Exceptions/FieldInjectorException.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ namespace Reflex.Exceptions
55
{
66
internal sealed class FieldInjectorException : Exception
77
{
8-
public FieldInjectorException(FieldInfo field, Exception e) : base(BuildMessage(field, e))
8+
public FieldInjectorException(FieldInfo field, Exception innerException) : base(BuildMessage(field, innerException), innerException)
99
{
1010
}
1111

12-
private static string BuildMessage(FieldInfo field, Exception e)
12+
private static string BuildMessage(FieldInfo field, Exception innerException)
1313
{
1414
var fieldDescription = $"'{field.DeclaringType.Name}.{field.Name}'";
15-
return $"Could not inject field {fieldDescription}, exception: {e}";
15+
return $"Could not inject field {fieldDescription}, inner exception: {innerException}";
1616
}
1717
}
1818
}

Assets/Reflex/Exceptions/MethodInjectorException.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ namespace Reflex.Exceptions
66
{
77
internal sealed class MethodInjectorException : Exception
88
{
9-
public MethodInjectorException(object obj, MethodInfo method, Exception e) : base(BuildMessage(obj, method, e))
9+
public MethodInjectorException(object obj, MethodInfo method, Exception innerException) : base(BuildMessage(obj, method, innerException), innerException)
1010
{
1111
}
1212

13-
private static string BuildMessage(object obj, MethodInfo method, Exception e)
13+
private static string BuildMessage(object obj, MethodInfo method, Exception innerException)
1414
{
1515
var parameters = method.GetParameters();
1616
var methodDescription = $"'{obj.GetType().Name}.{method.Name}'";
1717
var parametersDescription = $"'{string.Join(", ", parameters.Select(p => p.ParameterType.Name))}'";
18-
return $"Could not inject method {methodDescription} with parameters {parametersDescription}\n\n{e}";
18+
return $"Could not inject method {methodDescription} with parameters {parametersDescription}\n\n{innerException}";
1919
}
2020
}
2121
}

Assets/Reflex/Exceptions/PropertyInjectorException.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ namespace Reflex.Exceptions
55
{
66
internal sealed class PropertyInjectorException : Exception
77
{
8-
public PropertyInjectorException(PropertyInfo property, Exception e) : base(BuildMessage(property, e))
8+
public PropertyInjectorException(PropertyInfo property, Exception innerException) : base(BuildMessage(property, innerException))
99
{
1010
}
1111

12-
private static string BuildMessage(PropertyInfo property, Exception e)
12+
private static string BuildMessage(PropertyInfo property, Exception innerException)
1313
{
1414
var propertyDescription = $"'{property.DeclaringType.Name}.{property.Name}'";
15-
return $"Could not inject property {propertyDescription}, exception: {e}";
15+
return $"Could not inject property {propertyDescription}, inner exception: {innerException}";
1616
}
1717
}
1818
}

0 commit comments

Comments
 (0)