Skip to content

Commit 3599fc4

Browse files
committed
Update exception message for missing object mapping
1 parent abbcea5 commit 3599fc4

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

framework/src/Volo.Abp.Mapperly/Volo/Abp/Mapperly/MapperlyAutoObjectMappingProvider.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,26 +99,26 @@ public virtual TDestination Map<TSource, TDestination>(TSource source, TDestinat
9999
protected virtual AbpException GetNoMapperFoundException<TSource, TDestination>()
100100
{
101101
var newLine = Environment.NewLine;
102-
var message = "No type mapper class was found for the given source and destination types." +
102+
var message = "No object mapping was found for the specified source and destination types." +
103103
newLine +
104104
newLine +
105-
"Mapping types:" +
105+
"Mapping attempted:" +
106106
newLine +
107107
$"{typeof(TSource).Name} -> {typeof(TDestination).Name}" +
108108
newLine +
109109
$"{typeof(TSource).FullName} -> {typeof(TDestination).FullName}" +
110110
newLine +
111111
newLine +
112-
"Define a mapping class to resolve this issue:" +
112+
"How to fix:" +
113+
newLine +
114+
"Define a mapping class for these types:" +
113115
newLine +
114116
" - Use MapperBase<TSource, TDestination> for one-way mapping." +
115117
newLine +
116118
" - Use TwoWayMapperBase<TDestination, TSource> for two-way mapping." +
117119
newLine +
118120
newLine +
119-
"See the Mapperly documentation for details:" +
120-
newLine +
121-
"https://abp.io/docs/latest/framework/infrastructure/object-to-object-mapping#mapperly-integration";
121+
"For details, see the Mapperly integration document https://abp.io/docs/latest/framework/infrastructure/object-to-object-mapping#mapperly-integration";
122122

123123
return new AbpException(message);
124124
}

framework/test/Volo.Abp.Mapperly.Tests/Volo/Abp/Mapperly/AbpMapperlyModule_Basic_Tests.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,14 @@ public void Should_Map_Enum()
106106
public void Should_Throw_Exception_If_Mapper_Is_Not_Found()
107107
{
108108
var exception = Assert.Throws<AbpException>(() =>_objectMapper.Map<MyEntity, MyClassDto>(new MyEntity()));
109-
exception.Message.ShouldBe("No type mapper class was found for the given source and destination types.\n\n" +
110-
"Mapping types:\n" +
109+
exception.Message.ShouldBe("No object mapping was found for the specified source and destination types.\n\n" +
110+
"Mapping attempted:\n" +
111111
"MyEntity -> MyClassDto\n" +
112112
"Volo.Abp.Mapperly.SampleClasses.MyEntity -> Volo.Abp.Mapperly.MyClassDto\n\n" +
113-
"Define a mapping class to resolve this issue:\n" +
113+
"How to fix:\n" +
114+
"Define a mapping class for these types:" + "\n" +
114115
" - Use MapperBase<TSource, TDestination> for one-way mapping.\n" +
115116
" - Use TwoWayMapperBase<TDestination, TSource> for two-way mapping.\n\n" +
116-
"See the Mapperly documentation for details:\nhttps://abp.io/docs/latest/framework/infrastructure/object-to-object-mapping#mapperly-integration");
117+
"For details, see the Mapperly integration document https://abp.io/docs/latest/framework/infrastructure/object-to-object-mapping#mapperly-integration");
117118
}
118119
}

0 commit comments

Comments
 (0)