Skip to content

Commit

Permalink
Merge pull request #1059 from mpolacek1/issue/1058-more-descriptive-e…
Browse files Browse the repository at this point in the history
…xception-messages-in-MetaBodyWriter

#1058 - More descriptive InvalidOperationException messages in MetaBodyWriter class
  • Loading branch information
andersjonsson authored May 17, 2024
2 parents 49d57b6 + e68376d commit 6d2f2ac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/SoapCore/Meta/MetaBodyWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ private static Type GetMessageContractBodyType(Type type)
{
if (!TryGetMessageContractBodyType(type, out var bodyType))
{
throw new InvalidOperationException(nameof(type));
throw new InvalidOperationException(
$"Could not get {nameof(PropertyInfo)} or {nameof(FieldInfo)} of custom {nameof(MessageBodyMemberAttribute)} from custom {nameof(MessageContractAttribute)} of type: {type}");
}

return bodyType;
Expand All @@ -131,7 +132,8 @@ private static string GetMessageContractBodyName(Type type)
{
if (!TryGetMessageContractBodyMemberInfo(type, out var memberInfo))
{
throw new InvalidOperationException(nameof(type));
throw new InvalidOperationException(
$"Could not get {nameof(MemberInfo)} of custom {nameof(MessageBodyMemberAttribute)} from custom {nameof(MessageContractAttribute)} of type: {type}");
}

return memberInfo.Name;
Expand Down

0 comments on commit 6d2f2ac

Please sign in to comment.