-Improve OverflowException message for integer values larger than an Int64

This commit is contained in:
JamesNK
2010-04-25 07:26:01 +00:00
parent 7085a4915f
commit 6c817fee93
2 changed files with 18 additions and 1 deletions
+9 -1
View File
@@ -708,7 +708,15 @@ namespace Newtonsoft.Json
}
else
{
numberValue = Convert.ToInt64(number, CultureInfo.InvariantCulture);
try
{
numberValue = Convert.ToInt64(number, CultureInfo.InvariantCulture);
}
catch (OverflowException ex)
{
throw new JsonReaderException("JSON integer {0} is too large or small for an Int64.".FormatWith(CultureInfo.InvariantCulture, number), ex);
}
numberType = JsonToken.Integer;
}