THRIFT-4609 keep InnerException wherever appropriate
Client: C#
Patch: Jens Geyer
This closes #1576
diff --git a/lib/csharp/src/Protocol/TJSONProtocol.cs b/lib/csharp/src/Protocol/TJSONProtocol.cs
index 3390dc0..9dbdea9 100644
--- a/lib/csharp/src/Protocol/TJSONProtocol.cs
+++ b/lib/csharp/src/Protocol/TJSONProtocol.cs
@@ -859,19 +859,21 @@
{
ReadJSONSyntaxChar(QUOTE);
}
+
string str = ReadJSONNumericChars();
if (context.EscapeNumbers())
{
ReadJSONSyntaxChar(QUOTE);
}
+
try
{
return Int64.Parse(str);
}
- catch (FormatException)
+ catch (FormatException fex)
{
throw new TProtocolException(TProtocolException.INVALID_DATA,
- "Bad data encounted in numeric data");
+ "Bad data encounted in numeric data", fex);
}
}
@@ -887,8 +889,7 @@
byte[] arr = ReadJSONString(true);
double dub = Double.Parse(utf8Encoding.GetString(arr, 0, arr.Length), CultureInfo.InvariantCulture);
- if (!context.EscapeNumbers() && !Double.IsNaN(dub) &&
- !Double.IsInfinity(dub))
+ if (!context.EscapeNumbers() && !Double.IsNaN(dub) && !Double.IsInfinity(dub))
{
// Throw exception -- we should not be in a string in this case
throw new TProtocolException(TProtocolException.INVALID_DATA,
@@ -907,10 +908,10 @@
{
return Double.Parse(ReadJSONNumericChars(), CultureInfo.InvariantCulture);
}
- catch (FormatException)
+ catch (FormatException fex)
{
throw new TProtocolException(TProtocolException.INVALID_DATA,
- "Bad data encounted in numeric data");
+ "Bad data encounted in numeric data", fex);
}
}
}