Commit 4c131058 authored by Nick Craver's avatar Nick Craver

Error messages on cast failures for RedisValue

parent 44163e38
...@@ -495,7 +495,7 @@ internal static RedisValue TryParse(object obj) ...@@ -495,7 +495,7 @@ internal static RedisValue TryParse(object obj)
if (TryParseInt64(value._memory.Span, out i64)) return i64; if (TryParseInt64(value._memory.Span, out i64)) return i64;
break; break;
} }
throw new InvalidCastException(); throw new InvalidCastException($"Unable to case from {value.Type} to long");
} }
/// <summary> /// <summary>
...@@ -519,7 +519,7 @@ internal static RedisValue TryParse(object obj) ...@@ -519,7 +519,7 @@ internal static RedisValue TryParse(object obj)
if (TryParseInt64(value._memory.Span, out f64)) return f64; if (TryParseInt64(value._memory.Span, out f64)) return f64;
break; break;
} }
throw new InvalidCastException(); throw new InvalidCastException($"Unable to case from {value.Type} to double");
} }
private static bool TryParseDouble(ReadOnlySpan<byte> blob, out double value) private static bool TryParseDouble(ReadOnlySpan<byte> blob, out double value)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment