Skip to content
This repository was archived by the owner on Dec 24, 2022. It is now read-only.

Commit 10e9d20

Browse files
committed
Improve error message for numbers
1 parent 16d955a commit 10e9d20

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/ServiceStack.Text/DynamicNumber.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,11 @@ public static IDynamicNumber AssertNumbers(string name, object lhs, object rhs)
448448
{
449449
var number = GetNumber(lhs, rhs);
450450
if (number == null)
451-
throw new ArgumentException($"Invalid numbers passed to {name}: {lhs?.GetType().Name ?? "null"}, {rhs?.GetType().Name ?? "null"}");
451+
{
452+
throw new ArgumentException($"Invalid numbers passed to {name}: " +
453+
$"{lhs?.GetType().Name ?? "null"} '{lhs?.ToString().SubstringWithElipsis(0, 100)}', " +
454+
$"{rhs?.GetType().Name ?? "null"} '{rhs?.ToString().SubstringWithElipsis(0, 100)}'");
455+
}
452456

453457
return number;
454458
}

0 commit comments

Comments
 (0)